Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 09dc962c7d5510a835fdabf5f86512f07da6768d
https://github.com/WebKit/WebKit/commit/09dc962c7d5510a835fdabf5f86512f07da6768d
Author: Sosuke Suzuki <[email protected]>
Date: 2026-02-20 (Fri, 20 Feb 2026)
Changed paths:
A JSTests/stress/regexp-nongreedy-backref-max-count.js
M Source/JavaScriptCore/yarr/YarrJIT.cpp
Log Message:
-----------
[YARR] Fix operand reversal in non-greedy backreference max count check in JIT
https://bugs.webkit.org/show_bug.cgi?id=308045
Reviewed by Yusuke Suzuki.
In YarrJIT's backtracking code for non-greedy backreferences, the operands
of the max count comparison were reversed. branch32(AboveOrEqual, Imm32(max),
matchAmount) gets commuted by MacroAssembler, effectively testing
matchAmount <= max, which is always true when matchAmount starts at 0.
This caused the backreference to immediately fail on every backtrack attempt,
making patterns like /^(a)\1??$/ unable to match "aa" under JIT.
Fix by swapping the operands so that matchAmount is on the left and
Imm32(max) is on the right, correctly testing matchAmount >= max.
Test: JSTests/stress/regexp-nongreedy-backref-max-count.js
* JSTests/stress/regexp-nongreedy-backref-max-count.js: Added.
(shouldBe):
(shouldBeArray):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
Canonical link: https://commits.webkit.org/307899@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications