[webkit-dev] String::impl() returns NULL causes crash

Mo, Zhenyao zhenyao at gmail.com
Wed Apr 13 17:32:24 PDT 2011


I don't purposely trying to hash a null string, only that I
encountered a crash today, and tracing deep deep into the stack, the
cause is this.

So I looked at the file, also in line 110, hash() also assumes none-NULL input.

What value should we return for hash(NULL)?

On Wed, Apr 13, 2011 at 5:14 PM, Eric Seidel <eric at webkit.org> wrote:
> Why are you hashing a null string?  aka String().  We could make that
> function support null strings, but I guess it hasn't needed to until
> now.
>
> On Wed, Apr 13, 2011 at 5:00 PM, Mo, Zhenyao <zhenyao at gmail.com> wrote:
>> In StringHash.h line 89
>>
>> StringHash::hash(const String& key) { return key.impl()->hash(); }
>>
>> so it assumes String::impl() never returns NULL.
>>
>> However, I encountered a case where String::impl() is NULL, thus, crash.
>>
>> So what's wrong here?
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>


More information about the webkit-dev mailing list