Ignore:
Timestamp:
Jun 29, 2009, 3:33:55 PM (16 years ago)
Author:
[email protected]
Message:

<rdar://problem/7016214> JSON.parse fails to parse valid JSON with most Unicode characters
<https://bugs.webkit.org/show_bug.cgi?id=26802>

Reviewed by Gavin Barraclough.

In the original JSON.parse patch unicode was handled correctly, however in some last
minute "clean up" I oversimplified isSafeStringCharacter. This patch corrects this bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/LiteralParser.cpp

    r44984 r45356  
    125125}
    126126
    127 static inline bool isSafeStringCharacter(UChar c)
     127template <LiteralParser::ParserMode mode> static inline bool isSafeStringCharacter(UChar c)
    128128{
    129     return (c >= ' ' && c <= 0xff && c != '\\' && c != '"') || c == '\t';
     129    return (c >= ' ' && (mode == LiteralParser::StrictJSON || c <= 0xff) && c != '\\' && c != '"') || c == '\t';
    130130}
    131131
     
    137137    do {
    138138        runStart = m_ptr;
    139         while (m_ptr < m_end && isSafeStringCharacter(*m_ptr))
     139        while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
    140140            ++m_ptr;
    141141        if (runStart < m_ptr)
Note: See TracChangeset for help on using the changeset viewer.