Skip to content

Commit

Permalink
Stringifier::appendStringifiedValue() is missing an exception check.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=178386
<rdar://problem/35027610>

Reviewed by Saam Barati.

JSTests:

* stress/regress-178386.js: Added.

Source/JavaScriptCore:

* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):



Canonical link: https://commits.webkit.org/194743@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Mark Lam committed Oct 20, 2017
1 parent ed5b59e commit 4c76d71
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
10 changes: 10 additions & 0 deletions JSTests/ChangeLog
@@ -1,3 +1,13 @@
2017-10-19 Mark Lam <mark.lam@apple.com>

Stringifier::appendStringifiedValue() is missing an exception check.
https://bugs.webkit.org/show_bug.cgi?id=178386
<rdar://problem/35027610>

Reviewed by Saam Barati.

* stress/regress-178386.js: Added.

2017-10-19 Michael Saboff <msaboff@apple.com>

Test262: RegExp/property-escapes/generated/Emoji_Component.js fails with current RegExp Unicode Properties implementation
Expand Down
12 changes: 12 additions & 0 deletions JSTests/stress/regress-178386.js
@@ -0,0 +1,12 @@
var str1 = String.fromCharCode(136, 115, 29, 20, 15, 155, 81);
str3 = str1.padEnd(0x7FFFFFFC, '123');

var exception;
try {
JSON.stringify(str3);
} catch (e) {
exception = e;
}

if (exception != "Error: Out of memory")
throw "FAILED";
11 changes: 11 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
2017-10-19 Mark Lam <mark.lam@apple.com>

Stringifier::appendStringifiedValue() is missing an exception check.
https://bugs.webkit.org/show_bug.cgi?id=178386
<rdar://problem/35027610>

Reviewed by Saam Barati.

* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):

2017-10-19 Saam Barati <sbarati@apple.com>

REGRESSION(r223691): DFGByteCodeParser.cpp:1483:83: warning: comparison is always false due to limited range of data type [-Wtype-limits]
Expand Down
4 changes: 3 additions & 1 deletion Source/JavaScriptCore/runtime/JSONObject.cpp
Expand Up @@ -355,7 +355,9 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
}

if (value.isString()) {
builder.appendQuotedJSONString(asString(value)->value(m_exec));
const String& string = asString(value)->value(m_exec);
RETURN_IF_EXCEPTION(scope, StringifyFailed);
builder.appendQuotedJSONString(string);
return StringifySucceeded;
}

Expand Down

0 comments on commit 4c76d71

Please sign in to comment.