Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 46a4b17efbe9a1b9fe05a4ca8b6452650b001b51
      
https://github.com/WebKit/WebKit/commit/46a4b17efbe9a1b9fe05a4ca8b6452650b001b51
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    A JSTests/stress/regexp-negative-assertion-with-bol-is-not-dropped.js
    M Source/JavaScriptCore/yarr/YarrPattern.cpp

  Log Message:
  -----------
  [YARR] Do not filter the contents of a negative lookahead in `optimizeBOL`
https://bugs.webkit.org/show_bug.cgi?id=320611

Reviewed by Yusuke Suzuki.

    /^a|(?!^)b/.exec("b") // ["b"], should be null

optimizeBOL()'s loop copy drops subterms that can only match at the start of
the input, since the onceThrough copy already covers position 0. Inside a
negative lookahead this flips: (?!^) fails at the start of the input and
succeeds everywhere else, so after 317981@main filtered out its content the
whole term was dropped and the loop copy /b/ falsely matched at position 0.
copyTerm() now copies the contents of an inverted assertion unfiltered.

Test: JSTests/stress/regexp-negative-assertion-with-bol-is-not-dropped.js

* JSTests/stress/regexp-negative-assertion-with-bol-is-not-dropped.js: Added.
(shouldBe):
(check):
(step):
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::copyTerm):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to