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 m
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 wrote:
> In StringHash.h line 89
>
> StringHash::hash(const String& key) { return key.impl()->hash(); }
>
>
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
On Apr 13, 2011, at 5:32 PM, Mo, Zhenyao wrote:
> What value should we return for hash(NULL)?
From the top of the file:
// The hash() functions on StringHash and CaseFoldingHash do not support
// null strings. get(), contains(), and add() on HashMap
// cause a null-pointer dereferen
You are right. I figured out the issue.
It would be nice to ASSERT in the hash() functions (instead of in the
header) so people who encounter the NULL input will understand
immediately something else is wrong.
On Wed, Apr 13, 2011 at 6:04 PM, Gavin Barraclough
wrote:
> On Apr 13, 2011, at 5:32
5 matches
Mail list logo