Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: src/json-stringifier.h

Issue 1120573002: JSON serializer should fail gracefully for special value wrappers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test case Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-471702.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index 444de43e7bc79b04cc2aa0238f1159d62b774413..efb71e5fb11d59f74fdfa3f2f31e94974670497b 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -396,11 +396,14 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSValue(
isolate_, value, Execution::ToNumber(isolate_, object), EXCEPTION);
if (value->IsSmi()) return SerializeSmi(Smi::cast(*value));
SerializeHeapNumber(Handle<HeapNumber>::cast(value));
- } else {
- DCHECK(class_name == isolate_->heap()->Boolean_string());
+ } else if (class_name == isolate_->heap()->Boolean_string()) {
Object* value = JSValue::cast(*object)->value();
DCHECK(value->IsBoolean());
builder_.AppendCString(value->IsTrue() ? "true" : "false");
+ } else {
+ // Fail gracefully for special value wrappers.
+ isolate_->ThrowIllegalOperation();
+ return EXCEPTION;
}
return SUCCESS;
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-471702.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698