RESOLVED INVALID48102
YARR incorrectly matches later in string with alternate and sticky flag
https://bugs.webkit.org/show_bug.cgi?id=48102
Summary YARR incorrectly matches later in string with alternate and sticky flag
Oliver Hunt
Reported 2010-10-21 16:46:39 PDT
[reply] [-] Description Jesse Ruderman 2010-07-03 21:30:57 PDT /A|B/y.exec("CB") YARR: ["B"] Old: null I think YARR is correct and the old engine is incorrect. But I'd like a fix for the old engine so we can do more thorough compare-fuzzing to find bugs in YARR. [reply] [-] Comment 1 Chris Leary [:cdleary] 2010-07-04 00:05:52 PDT Since lastIndex is 0, the old engine is correct. I'll take a look. [reply] [-] Comment 2 Jesse Ruderman 2010-07-04 00:33:15 PDT Ahh, I missed the part where /y means not only "start at lastIndex" but also "don't match forward". (As if there were a ^ at the beginning of the regexp and you had sliced the string.) [reply] [-] Comment 3 Chris Leary [:cdleary] 2010-08-27 15:31:59 PDT Created attachment 470057 [details] Fix sticky patterns with disjunctions. Whoops, rookie mistake -- the caret was getting stuck to the LHS of the disjunction. Need to wrap the rest of the expression in (?:) to keep things balanced across disjunctions. This fixes it: $ ./js -e 'print(/A|B/y.exec("CB"))' null [reply] [-] Comment 4
Attachments
Gavin Barraclough
Comment 1 2010-11-21 08:45:33 PST
//y looks like a Firefox specific extension, which we neither support nor intend to add support for right now. Unless this position changes, this is not a bug that affects WebKit.
Alexey Proskuryakov
Comment 2 2010-11-22 11:46:58 PST
Gavin, this bug looks like it's about a difference between YARR and old behavior. Its title implies a YARR bug, but it's description implies a bug in old code. Should either of them be fixed?
Gavin Barraclough
Comment 3 2010-11-23 18:21:57 PST
Hi Alexey, I don't think you are understanding this fully. This is a clone of a Firefox bug, and describes a divergence between YARR and *Firefox*'s old behaviour. This was not ES5 compliant behaviour (I think it is possible this was an ES4 feature that they supported). This bug does not, to the best of my knowledge, describe a divergence between YARR and our old behaviour, a divergence between YARR and ES5 spec'ed behaviour, anything that could in any sense be described as a bug in WebKit, or for that matter anything we care about at all! The only issue to resolve here is for Firefox, in resolving the compatibility of their port of YARR with the ES4 features supported by their PCRE port. cheers, G.
Note You need to log in before you can comment on or make changes to this bug.