[webkit-dev] String::impl() returns NULL causes crash
barraclough at apple.com
Wed Apr 13 18:04:55 PDT 2011
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<String,..., StringHash>
// cause a null-pointer dereference when passed null strings.
In the hash traits for String, we use String() as the empty value for hash tables keyed on a string. Our hash tables will not work correctly if the hash trait's empty value is used as a key in the table, so allowing a null string to be hashed & used as a key would only result in later errors. We should probably ASSERT in the hash methods that the Strings/StringImpls passed to the hash() methods in StringHash are not null.
To fix your problem you will need to find what is using a null string as a key in a hashtable, and stop it – making hash() return a value for the null string will not fix this bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev