Changeset 108841 in webkit
- Timestamp:
- Feb 24, 2012 1:10:36 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r108839 r108841 1 2012-02-24 Gavin Barraclough <barraclough@apple.com> 2 3 Should not allow malformed \x escapes 4 https://bugs.webkit.org/show_bug.cgi?id=79462 5 6 Reviewed by Oliver Hunt. 7 8 * fast/regex/script-tests/pcre-test-1.js: 9 - Fix bad escapes in test case. 10 * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A4.3_T6-expected.txt: 11 * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.1_T4-expected.txt: 12 * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.2_T1-expected.txt: 13 * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.2_T2-expected.txt: 14 - Check in passing results. 15 1 16 2012-02-24 Adrienne Walker <enne@google.com> 2 17 -
trunk/LayoutTests/fast/regex/script-tests/pcre-test-1.js
r98407 r108841 1037 1037 var results = null; 1038 1038 shouldBe('regex68.exec(input2);', 'results'); 1039 var input3 = "A\0\ x0\0\x0Z";1039 var input3 = "A\0\0\0\0Z"; 1040 1040 var results = null; 1041 1041 shouldBe('regex68.exec(input3);', 'results'); -
trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A4.3_T6-expected.txt
r58534 r108841 1 CONSOLE MESSAGE: line 77: SyntaxError: \x can only be followed by a hex character sequence 1 2 S7.8.4_A4.3_T6 2 3 3 FAIL No error detected 4 PASS Expected parsing failure 4 5 5 6 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.1_T4-expected.txt
r58534 r108841 1 CONSOLE MESSAGE: line 77: SyntaxError: \x can only be followed by a hex character sequence 1 2 S7.8.4_A6.1_T4 2 3 3 FAIL No error detected 4 PASS Expected parsing failure 4 5 5 6 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.2_T1-expected.txt
r58534 r108841 1 CONSOLE MESSAGE: line 77: SyntaxError: \x can only be followed by a hex character sequence 1 2 S7.8.4_A6.2_T1 2 3 3 FAIL No error detected 4 PASS Expected parsing failure 4 5 5 6 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A6.2_T2-expected.txt
r58534 r108841 1 CONSOLE MESSAGE: line 77: SyntaxError: \x can only be followed by a hex character sequence 1 2 S7.8.4_A6.2_T2 2 3 3 FAIL No error detected 4 PASS Expected parsing failure 4 5 5 6 TEST COMPLETE -
trunk/Source/JavaScriptCore/ChangeLog
r108820 r108841 1 2012-02-24 Gavin Barraclough <barraclough@apple.com> 2 3 Should not allow malformed \x escapes 4 https://bugs.webkit.org/show_bug.cgi?id=79462 5 6 Reviewed by Oliver Hunt. 7 8 * parser/Lexer.cpp: 9 (JSC::::parseString): 10 (JSC::::parseStringSlowCase): 11 - Prohibit malformed '\x' escapes 12 * tests/mozilla/ecma/Array/15.4.5.1-1.js: 13 * tests/mozilla/ecma/LexicalConventions/7.7.4.js: 14 * tests/mozilla/ecma_2/RegExp/hex-001.js: 15 * tests/mozilla/js1_2/regexp/hexadecimal.js: 16 - Remove erroneous test cases (correct behaviour is tested by LayoutTests/sputnik). 17 1 18 2012-02-24 Daniel Bates <dbates@webkit.org> 2 19 -
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r108742 r108841 693 693 else if (m_current == 'x') { 694 694 shift(); 695 if (isASCIIHexDigit(m_current) && isASCIIHexDigit(peek(1))) { 696 int prev = m_current; 697 shift(); 698 if (shouldBuildStrings) 699 record8(convertHex(prev, m_current)); 700 shift(); 701 } else if (shouldBuildStrings) 702 record8('x'); 695 if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) { 696 m_lexErrorMessage = "\\x can only be followed by a hex character sequence"; 697 return false; 698 } 699 int prev = m_current; 700 shift(); 701 if (shouldBuildStrings) 702 record8(convertHex(prev, m_current)); 703 shift(); 703 704 } else { 704 705 setOffset(startingOffset); … … 757 758 else if (m_current == 'x') { 758 759 shift(); 759 if (isASCIIHexDigit(m_current) && isASCIIHexDigit(peek(1))) { 760 int prev = m_current; 761 shift(); 762 if (shouldBuildStrings) 763 record16(convertHex(prev, m_current)); 764 shift(); 765 } else if (shouldBuildStrings) 766 record16('x'); 760 if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) { 761 m_lexErrorMessage = "\\x can only be followed by a hex character sequence"; 762 return false; 763 } 764 int prev = m_current; 765 shift(); 766 if (shouldBuildStrings) 767 record16(convertHex(prev, m_current)); 768 shift(); 767 769 } else if (m_current == 'u') { 768 770 shift(); -
trunk/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js
r16542 r108841 105 105 106 106 for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { 107 if ( i === 0x58 || i === 0x78 ) // x or X - skip testing invalid hex escapes. 108 continue; 107 109 TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; 108 110 if ( i < 0x00FF - 1 ) { … … 113 115 } 114 116 115 var LENGTH = 0x00ff - 0x0020 ;117 var LENGTH = 0x00ff - 0x0020 - 2; // x & X 116 118 117 119 array[item++] = new TestCase( SECTION, -
trunk/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js
r53061 r108841 171 171 172 172 // G is out of hex range 173 174 array[item++] = new TestCase( SECTION, "\\xG", "xG", "\xG" );175 array[item++] = new TestCase( SECTION, "\\xCG", "xCG", "\xCG" );173 // Invalid hex escapes are syntax error; these are covered in the sputnik test suite. 174 // array[item++] = new TestCase( SECTION, "\\xG", "xG", "\xG" ); 175 // array[item++] = new TestCase( SECTION, "\\xCG", "xCG", "\xCG" ); 176 176 177 177 // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter … … 194 194 195 195 array[item++] = new TestCase( SECTION, "\\w", "w", "\w" ); 196 array[item++] = new TestCase( SECTION, "\\x", "x", "\x" ); 196 // Invalid hex escapes are syntax error; these are covered in the sputnik test suite. 197 // array[item++] = new TestCase( SECTION, "\\x", "x", "\x" ); 197 198 array[item++] = new TestCase( SECTION, "\\y", "y", "\y" ); 198 199 array[item++] = new TestCase( SECTION, "\\z", "z", "\z" ); -
trunk/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js
r11995 r108841 17 17 AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] ); 18 18 AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] ); 19 AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] ); 19 // Invalid hex escapes are syntax error; these are covered in the sputnik test suite. 20 // AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] ); 20 21 21 22 AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] ); -
trunk/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js
r53061 r108841 31 31 var VERSION = 'no version'; 32 32 startTest(); 33 var TITLE = 'RegExp: \ x# (hex) ';33 var TITLE = 'RegExp: \\x# (hex) '; 34 34 35 35 writeHeaderToLog('Executing script: hexadecimal.js');
Note: See TracChangeset
for help on using the changeset viewer.