Ignore:
Timestamp:
Oct 4, 2012, 1:27:45 PM (13 years ago)
Author:
[email protected]
Message:

Crash in Safari at com.apple.JavaScriptCore: WTF::StringImpl::is8Bit const + 12
https://bugs.webkit.org/show_bug.cgi?id=98433

Reviewed by Jessie Berlin.

The problem is due to a String with a null StringImpl (i.e. a null string).
Added a length check before the is8Bit() check since length() checks for a null StringImpl. Changed the
characters16() call to characters() since it can handle a null StringImpl as well.

  • API/JSValueRef.cpp:

(JSValueMakeFromJSONString):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSValueRef.cpp

    r130303 r130424  
    236236    APIEntryShim entryShim(exec);
    237237    String str = string->string();
    238     if (str.is8Bit()) {
    239         LiteralParser<LChar> parser(exec, str.characters8(), str.length(), StrictJSON);
     238    unsigned length = str.length();
     239    if (length && str.is8Bit()) {
     240        LiteralParser<LChar> parser(exec, str.characters8(), length, StrictJSON);
    240241        return toRef(exec, parser.tryLiteralParse());
    241242    }
    242     LiteralParser<UChar> parser(exec, str.characters16(), str.length(), StrictJSON);
     243    LiteralParser<UChar> parser(exec, str.characters(), length, StrictJSON);
    243244    return toRef(exec, parser.tryLiteralParse());
    244245}
Note: See TracChangeset for help on using the changeset viewer.