Ignore:
Timestamp:
Nov 29, 2010, 10:52:16 AM (15 years ago)
Author:
[email protected]
Message:

Bug 48100 - YARR allows what seems like a bogus character-class range

Reviewed by Sam Weinig.

JavaScriptCore:

Per ECMA-262 character classes containing character ranges containing
character classes are invalid, eg:

/[\d-x]/
/[x-\d]/
/[\d-\d]/

These should throw a syntax error.

  • yarr/RegexParser.h:

LayoutTests:

Add/update layout test results.

  • fast/js/regexp-overflow-expected.txt:
  • fast/js/regexp-ranges-and-escaped-hyphens-expected.txt:
  • fast/js/script-tests/regexp-overflow.js:
  • fast/js/script-tests/regexp-ranges-and-escaped-hyphens.js:
  • fast/regex/invalid-range-in-class-expected.txt: Added.
  • fast/regex/invalid-range-in-class.html: Added.
  • fast/regex/script-tests/invalid-range-in-class.js: Added.
  • fast/regex/test1-expected.txt:
  • fast/regex/test4-expected.txt:
  • fast/regex/testinput4:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/js/script-tests/regexp-overflow.js

    r72489 r72813  
    1818shouldBe('/[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}[\u00A1]{1,100}/.exec("\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1").toString()', '"\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1\u00A1"');
    1919
    20 shouldBe('/{([\\D-\\ca]]„£µ+?)}|[[\\B-\\u00d4]√π- ]]]{0,3}/i.exec("B√π- ]]").toString()', '"B√π- ]],"');
     20shouldBe('/{([\\D\\-\\ca]]„£µ+?)}|[[\\B-\\u00d4]√π- ]]]{0,3}/i.exec("B√π- ]]").toString()', '"B√π- ]],"');
    2121shouldBe('/|[x\\B-\\u00b5]/i.exec("").toString()', '""');
    2222
Note: See TracChangeset for help on using the changeset viewer.