-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 271458@main (d1f1209). https://bugs.webkit.org/show_bug.c…
…gi?id=265775 Gracefully handle OOM while trying to describing a Symbol when creating an Error. https://bugs.webkit.org/show_bug.cgi?id=265775 rdar://119046215 Reviewed by Yusuke Suzuki. If trying to describe a Symbol via stringifying it results in an OutOfMemoryError, just simply describe is as a generic "Symbol" instead. * JSTests/stress/out-of-memory-while-describing-symbol-for-error.js: Added. (catch): * Source/JavaScriptCore/runtime/ExceptionHelpers.cpp: (JSC::errorDescriptionForValue): * Source/JavaScriptCore/runtime/Symbol.cpp: (JSC::Symbol::tryGetDescriptiveString const): * Source/JavaScriptCore/runtime/Symbol.h: Canonical link: https://commits.webkit.org/271458@main
- Loading branch information
Showing
4 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
JSTests/stress/out-of-memory-while-describing-symbol-for-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ skip if $memoryLimited | ||
|
||
let a = "?".repeat(2147483647); | ||
var exception; | ||
try { | ||
var s = Symbol(a); | ||
new s(2); | ||
} catch (e) { | ||
exception = e; | ||
} | ||
|
||
if (exception != "TypeError: Symbol is not a constructor (evaluating 'new s(2)')") | ||
throw "FAILED"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters