Changeset 201737 in webkit


Ignore:
Timestamp:
Jun 6, 2016 8:02:06 PM (8 years ago)
Author:
msaboff@apple.com
Message:

octal and binary parsing is wrong for some programs
https://bugs.webkit.org/show_bug.cgi?id=158437

Reviewed by Saam Barati.

When there is an error parsing an binary or octal literal, we need to clear the returnValue
of any residual value. This is because the processing of returnValue happens before the
syntax check for the extra character. Without clearing returnValue, we end trying to
categorize the value as an INTEGER or DOUBLE token. If the value happens to be an
impure NaN, we ASSERT.

  • parser/Lexer.cpp:

(JSC::Lexer<T>::parseBinary):
(JSC::Lexer<T>::parseOctal):

  • tests/stress/regress-158437.js: New test.
Location:
trunk/Source/JavaScriptCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r201733 r201737  
     12016-06-06  Michael Saboff  <msaboff@apple.com>
     2
     3        octal and binary parsing is wrong for some programs
     4        https://bugs.webkit.org/show_bug.cgi?id=158437
     5
     6        Reviewed by Saam Barati.
     7
     8        When there is an error parsing an binary or octal literal, we need to clear the returnValue
     9        of any residual value.  This is because the processing of returnValue happens before the
     10        syntax check for the extra character.  Without clearing returnValue, we end trying to
     11        categorize the value as an INTEGER or DOUBLE token.  If the value happens to be an
     12        impure NaN, we ASSERT.
     13
     14        * parser/Lexer.cpp:
     15        (JSC::Lexer<T>::parseBinary):
     16        (JSC::Lexer<T>::parseOctal):
     17        * tests/stress/regress-158437.js: New test.
     18
    1192016-06-06  Mark Lam  <mark.lam@apple.com>
    220
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r200038 r201737  
    15691569    }
    15701570
    1571     if (isASCIIDigit(m_current))
     1571    if (isASCIIDigit(m_current)) {
     1572        returnValue = 0;
    15721573        return false;
     1574    }
    15731575
    15741576    returnValue = parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 2);
     
    16071609    }
    16081610
    1609     if (isASCIIDigit(m_current))
     1611    if (isASCIIDigit(m_current)) {
     1612        returnValue = 0;
    16101613        return false;
     1614    }
    16111615
    16121616    returnValue = parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 8);
Note: See TracChangeset for help on using the changeset viewer.