Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ca5992c5df2153d9b5e79310e988834b702ff5ee
https://github.com/WebKit/WebKit/commit/ca5992c5df2153d9b5e79310e988834b702ff5ee
Author: Sosuke Suzuki <[email protected]>
Date: 2026-03-26 (Thu, 26 Mar 2026)
Changed paths:
A
JSTests/stress/regexp-unicode-nonbmp-fixed-width-charclass-index-overshoot.js
M Source/JavaScriptCore/yarr/YarrJIT.cpp
Log Message:
-----------
[YARR] Greedy/non-greedy non-BMP character class should not advance index
past end-of-input
https://bugs.webkit.org/show_bug.cgi?id=309870
Reviewed by Yusuke Suzuki.
advanceIndexAfterCharacterClassTermMatch's fixed-width fast path
adds 2 to the index unconditionally for non-BMP-only classes, which
can leave index at length+1 after the last iteration. A subsequent
fixed-character term then reads one unit past the end of input.
The mixed-width else branch already splits this into
+1 -> atEndOfInput -> +1; do the same here. Both callers already
roll back via failuresAfterIncrementingIndex. This also makes
generateCharacterClassGreedy's checkNotEnoughInput(1) pre-check
redundant.
Also drop a redundant !term->invert() already covered by
isFixedWidthCharacterClass().
Test:
JSTests/stress/regexp-unicode-nonbmp-fixed-width-charclass-index-overshoot.js
*
JSTests/stress/regexp-unicode-nonbmp-fixed-width-charclass-index-overshoot.js:
Added.
(shouldBe):
(makeSubstring):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
Canonical link: https://commits.webkit.org/309968@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications