[Webkit-unassigned] [Bug 88936] StringImpl::characters can return NULL for an empty string

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 13 15:31:32 PDT 2012


--- Comment #10 from Darin Adler <darin at apple.com>  2012-06-13 15:31:31 PST ---
(From update of attachment 147419)
View in context: https://bugs.webkit.org/attachment.cgi?id=147419&action=review

>> Source/WTF/wtf/unicode/icu/CollatorICU.cpp:106
>> +      rhs = (const UChar*)"";
> This is wrong. You can’t just cast the pointer to an empty C string to a UChar* and expect it to work. That will read off the end of the buffer.

Oh, I see, maybe I am wrong. This can literally be any pointer other than a null pointer! Still, do we really need a typecast? I suggest this:

    UChar character;
    if (!lhsLength)
        lhs = &character;
    if (!rhsLength)
        rhs = &character;

Lets avoid that messy casting and also avoid making the conditions too complex.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list