WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
260928
[Yarr] Yarr JIT returns a nested capture when an outer paren matches a zero length string
https://bugs.webkit.org/show_bug.cgi?id=260928
Summary
[Yarr] Yarr JIT returns a nested capture when an outer paren matches a zero l...
Michael Saboff
Reported
2023-08-30 15:38:05 PDT
Consider the RegExp /(?:(?=(abc)))?a/. The lookahead assertion contains a captured sub pattern of "abc". The outer group is quantified with the '?' suffix, which means it can match 0 or 1 times. When this RegExp is used to match the string "abc", the assertion will match the "abc" and that sub pattern will be captured. The ECMAScript spec in [RepeastMatcher](
https://tc39.es/ecma262/#sec-runtime-semantics-repeatmatcher-abstract-operation
) for the case where the minimum match quantity is 0. See step 2.b. in the spec link. The Yarr interpreter matches as the spec requires, returning the capture only if the quantifier has a minimum of 1. The Yarr JIT however always returns the nested capture, irrespective of the quantifier for the outer paren. Therefore the JIT needs to be fix to match the spec and the interpreter.
Attachments
Add attachment
proposed patch, testcase, etc.
Michael Saboff
Comment 1
2023-08-30 15:38:18 PDT
<
rdar://106376813
>
Michael Saboff
Comment 2
2023-08-30 15:51:37 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/17254
EWS
Comment 3
2023-08-30 23:03:08 PDT
Committed
267486@main
(e5b0472ba9a2): <
https://commits.webkit.org/267486@main
> Reviewed commits have been landed. Closing PR #17254 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug