Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1a29b8cfcf8d065176502b18ca611443e3a1b615
https://github.com/WebKit/WebKit/commit/1a29b8cfcf8d065176502b18ca611443e3a1b615
Author: Sosuke Suzuki <[email protected]>
Date: 2026-09-08 (Tue, 08 Sep 2026)
Changed paths:
A JSTests/stress/regexp-v-flag-escaped-hyphen-after-set-operand.js
M Source/JavaScriptCore/yarr/YarrParser.h
Log Message:
-----------
[YARR] `\-` following a class set operand in a `/v` class throws a SyntaxError
https://bugs.webkit.org/show_bug.cgi?id=323496
Reviewed by Yusuke Suzuki.
In the AfterSetOperand state, atomPatternCharacter() rejected every
hyphen, so /[[a]\-]/v and /[\q{ab}\-]/v threw SyntaxError even though
\- is a valid ClassSetReservedPunctuator escape. The other states
added in 320216@main accept an escaped hyphen by checking
processingEscape; this state did not.
Checking processingEscape here also requires clearing
m_processingEscape when a set operand ends without reaching
atomPatternCharacter(): a nested class or a \q{} string disjunction
leaves the flag set by its last escape, so an unescaped hyphen right
after it, as in /[[\d]-c]/v or /[\q{ab}-c]/v, would have been treated
as escaped. nestedClassEnd() and afterSetOperand() now reset it.
Test: JSTests/stress/regexp-v-flag-escaped-hyphen-after-set-operand.js
* JSTests/stress/regexp-v-flag-escaped-hyphen-after-set-operand.js: Added.
(shouldBe):
* Source/JavaScriptCore/yarr/YarrParser.h:
(JSC::Yarr::Parser::ClassSetParserDelegate::nestedClassEnd):
(JSC::Yarr::Parser::ClassSetParserDelegate::afterSetOperand):
(JSC::Yarr::Parser::ClassSetParserDelegate::atomPatternCharacter):
Canonical link: https://commits.webkit.org/320683@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications