Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7adb2e46f423468de209bb1f19bddad6f9b629cb
      
https://github.com/WebKit/WebKit/commit/7adb2e46f423468de209bb1f19bddad6f9b629cb
  Author: Sosuke Suzuki <[email protected]>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    A JSTests/stress/regexp-v-flag-non-range-hyphen.js
    M Source/JavaScriptCore/yarr/YarrParser.h
    M Source/JavaScriptCore/yarr/YarrPattern.cpp
    M Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
    M Source/WebCore/contentextensions/URLFilterParser.cpp

  Log Message:
  -----------
  [JSC] `\-` shouldn't be parsed as range with `v` flag
https://bugs.webkit.org/show_bug.cgi?id=288223

Reviewed by Yusuke Suzuki.

`[\d\-a]` should be parsed as a character class consisting of `\d`,a hyphen
(0x002D), and `a`. However, in the current JSC implementation, if the `v`
flag is enabled, the hyphen is treated as a range operator, causing a syntax
error to be thrown. This patch fixes that behavior.

This patch adds a `hyphenIsRange` argument to the `atomPatternCharacter` method
in `ClassSetParserDelegate`. This matches the interface of the
`atomPatternCharacter` method in `CharacterClassParserDelegate`.

* JSTests/stress/regexp-v-flag-non-range-hyphen.js: Added.
(compareArray):
(throw.new.Error):
(shouldBe):
* Source/JavaScriptCore/yarr/YarrParser.h:
(JSC::Yarr::Parser::ClassSetParserDelegate::atomPatternCharacter):
(JSC::Yarr::Parser::parseClassSet):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to