Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: faf717c136d1e8bf14533462f76179b7831117f7
      
https://github.com/WebKit/WebKit/commit/faf717c136d1e8bf14533462f76179b7831117f7
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    A 
JSTests/stress/regexp-unicode-case-insensitive-ascii-range-canonical-set.js
    M Source/JavaScriptCore/yarr/YarrPattern.cpp

  Log Message:
  -----------
  [YARR] `putRange()` misses Unicode canonical equivalents U+017F and U+212A 
for ASCII ranges
https://bugs.webkit.org/show_bug.cgi?id=316056

Reviewed by Yusuke Suzuki.

CharacterClassConstructor::putRange() has an ASCII fast path that only
performs +/-0x20 case folding and returns early when the entire range is
ASCII. This is correct in UCS2 canonical mode, but in Unicode canonical
mode (/iu and /iv flags), U+212A KELVIN SIGN canonicalizes to 'k' and
U+017F LATIN SMALL LETTER LONG S canonicalizes to 's', so character
class ranges covering those ASCII letters must also match the non-ASCII
equivalents. As a result, /[a-z]/iu.test("ſ") returned false while
/[s]/iu.test("ſ") returned true, and V8 returns true for both.

putChar() already gates its ASCII fast path on
m_canonicalMode == CanonicalMode::UCS2. Apply the same gating to
putRange(): in case-insensitive Unicode canonical mode, skip the fast
path and let the existing canonicalization table walk handle the whole
range. The Unicode range info table fully covers ASCII (including the
CanonicalizeSet entries for k/K and s/S), and addSortedRange() already
splits ranges at the Latin-1 boundary, so the table walk produces the
correct matches for ASCII ranges as well.

Test: 
JSTests/stress/regexp-unicode-case-insensitive-ascii-range-canonical-set.js

* JSTests/stress/regexp-unicode-case-insensitive-ascii-range-canonical-set.js: 
Added.
(shouldBe):
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::CharacterClassConstructor::putRange):

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



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

Reply via email to