diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog index 804db8dd4c6d..b4a0d5196bc8 100644 --- a/JSTests/ChangeLog +++ b/JSTests/ChangeLog @@ -1,3 +1,13 @@ +2017-10-19 Mark Lam + + Stringifier::appendStringifiedValue() is missing an exception check. + https://bugs.webkit.org/show_bug.cgi?id=178386 + + + Reviewed by Saam Barati. + + * stress/regress-178386.js: Added. + 2017-10-19 Michael Saboff Test262: RegExp/property-escapes/generated/Emoji_Component.js fails with current RegExp Unicode Properties implementation diff --git a/JSTests/stress/regress-178386.js b/JSTests/stress/regress-178386.js new file mode 100644 index 000000000000..3c66e09c4a19 --- /dev/null +++ b/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"; diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 36685e28ca7c..77841eee6454 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,14 @@ +2017-10-19 Mark Lam + + Stringifier::appendStringifiedValue() is missing an exception check. + https://bugs.webkit.org/show_bug.cgi?id=178386 + + + Reviewed by Saam Barati. + + * runtime/JSONObject.cpp: + (JSC::Stringifier::appendStringifiedValue): + 2017-10-19 Saam Barati REGRESSION(r223691): DFGByteCodeParser.cpp:1483:83: warning: comparison is always false due to limited range of data type [-Wtype-limits] diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp index 8f4a2282751d..dbf1a356a914 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.cpp +++ b/Source/JavaScriptCore/runtime/JSONObject.cpp @@ -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; }