[webkit-changes] [WebKit/WebKit] 21dd74: Improve overflow handing ergonomics in JSStringJoi...
Commit Queue
noreply at github.com
Fri Jan 5 08:27:49 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 21dd74926ee09f152bff236747b4621a05f0983b
https://github.com/WebKit/WebKit/commit/21dd74926ee09f152bff236747b4621a05f0983b
Author: Mark Lam <mark.lam at apple.com>
Date: 2024-01-05 (Fri, 05 Jan 2024)
Changed paths:
M Source/JavaScriptCore/runtime/JSStringJoiner.cpp
M Source/JavaScriptCore/runtime/JSStringJoiner.h
M Source/WTF/wtf/Vector.h
Log Message:
-----------
Improve overflow handing ergonomics in JSStringJoiner::append().
https://bugs.webkit.org/show_bug.cgi?id=267111
rdar://120389377
Reviewed by Justin Michaud.
Currently, JSStringJoiner::append() appends to its m_string Vector. As a result, if an overflow
is imminent, it crashes. We change the code to use tryAppend() instead and remember if an
overflow was detected instead. If so, JSStringJoiner::join() can throw an OutOfMemory error later.
* Source/JavaScriptCore/runtime/JSStringJoiner.cpp:
(JSC::JSStringJoiner::joinSlow):
* Source/JavaScriptCore/runtime/JSStringJoiner.h:
(JSC::JSStringJoiner::join):
(JSC::JSStringJoiner::append):
(JSC::JSStringJoiner::append8Bit):
(JSC::JSStringJoiner::appendEmptyString):
* Source/WTF/wtf/Vector.h:
(WTF::Vector::tryAppend):
Canonical link: https://commits.webkit.org/272688@main
More information about the webkit-changes
mailing list