[webkit-changes] [WebKit/WebKit] e5b047: [Yarr] Yarr JIT returns a nested capture when an o...

Michael Saboff noreply at github.com
Wed Aug 30 23:03:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e5b0472ba9a22ebaedf4ddd9cfc3a20c931cc0b3
      https://github.com/WebKit/WebKit/commit/e5b0472ba9a22ebaedf4ddd9cfc3a20c931cc0b3
  Author: Michael Saboff <msaboff at apple.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M JSTests/stress/regexp-lookaround-captures.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.h

  Log Message:
  -----------
  [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
rdar://106376813

Reviewed by Yusuke Suzuki.

Corrected the behavior of the YARR JIT to match the ECMAScript spec and the YARR Interpreter when the matched contents
of a 0 based quantified group is the empty string.  In this case, any nested capture should be undefined.  This
case can happen if the nested contents contain an assertion that captured itself.

The fix is to clear any nested captures when we backtrack through the outer parenthesis group.

* JSTests/stress/regexp-lookaround-captures.js: Added new tests.
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrPattern.h:
(JSC::Yarr::PatternTerm::containsAnyCaptures):

Canonical link: https://commits.webkit.org/267486@main




More information about the webkit-changes mailing list