[webkit-changes] [WebKit/WebKit] 211efd: Make regExpConstructorEscape() handle OOME more gr...

Commit Queue noreply at github.com
Thu Jan 9 01:54:01 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 211efd9b429266d3f8ee0d488e033b2ad34a7880
      https://github.com/WebKit/WebKit/commit/211efd9b429266d3f8ee0d488e033b2ad34a7880
  Author: Mark Lam <mark.lam at apple.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    A JSTests/stress/regexp-escape-oom.js
    M Source/JavaScriptCore/runtime/RegExpConstructor.cpp
    M Source/WTF/wtf/text/StringBuilder.h

  Log Message:
  -----------
  Make regExpConstructorEscape() handle OOME more gracefully.
https://bugs.webkit.org/show_bug.cgi?id=285575
rdar://142475010

Reviewed by Yusuke Suzuki.

Changed regExpConstructorEscape() to use the StringBuilder with OverflowPolicy::RecordOverflow.
With this, we can throw an OOME instead of crashing when an imminent overflow is detected.

Also fixed StringBuilder::span() to be able to handle overflows for OverflowPolicy::RecordOverflow.

* JSTests/stress/regexp-escape-oom.js: Added.
(catch):
* Source/JavaScriptCore/runtime/RegExpConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/WTF/wtf/text/StringBuilder.h:
(WTF::StringBuilder::span const):

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



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


More information about the webkit-changes mailing list