Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 28426f73148a87823f5a1ffa0b2ef1bd9f658d2b
      
https://github.com/WebKit/WebKit/commit/28426f73148a87823f5a1ffa0b2ef1bd9f658d2b
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    A JSTests/stress/regexp-unicode-surrogate-mask.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp

  Log Message:
  -----------
  [YARR] surrogateTagMask should be 0xfc00/0xfc00 instead of 0xdc00/0xdc00
https://bugs.webkit.org/show_bug.cgi?id=319651
rdar://182474262

Reviewed by Yijia Huang.

We are checking the surrogates like this.

    jit.load32(Address(...), resultReg);
    jit.and32AndSetFlags(surrogateTagMask, resultReg, temp);
    isBMP.append(jit.branch(Zero));
    slowCases.append(jit.branch32(NotEqual, temp, surrogatePairTags));

Previously, the surrogateTagMask was 0xdc00/0xdc00. Then 0xf800 etc. can
pass the above filter and incorrectly recognized as a surrogate. This
patch fixes it by making surrogateTagMask 0xfc00/0xfc00 so we can correctly
filter out surrogates.

Test: JSTests/stress/regexp-unicode-surrogate-mask.js

* JSTests/stress/regexp-unicode-surrogate-mask.js: Added.
(shouldBe):
(i.cps.of.cases.a.toString):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
(JSC::Yarr::tryReadUnicodeCharSlowImpl):

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



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

Reply via email to