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

Unified Diff: src/json-stringifier.h

Issue 11265011: Fix stack overflow in JSON.stringify. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | « build/common.gypi ('k') | test/mjsunit/json-recursive.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 4b9b0b6be9baabb8b3c30e9e6ecac98f23fcf5f7..3f59ca2f63abf68e05bb53f24f24fbbaf595aa26 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -45,7 +45,7 @@ class BasicJsonStringifier BASE_EMBEDDED {
static const int kInitialPartLength = 32;
static const int kMaxPartLength = 16 * 1024;
static const int kPartLengthGrowthFactor = 2;
- static const int kStackLimit = 8 * 1024;
+ static const int kStackLimit = 4 * 1024;
enum Result { UNCHANGED, SUCCESS, BAILOUT, CIRCULAR, STACK_OVERFLOW };
@@ -399,7 +399,8 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeDouble(
BasicJsonStringifier::Result BasicJsonStringifier::SerializeArray(
Handle<JSArray> object) {
HandleScope handle_scope(isolate_);
- if (StackPush(object) == CIRCULAR) return CIRCULAR;
+ Result stack_push = StackPush(object);
+ if (stack_push != SUCCESS) return stack_push;
int length = Smi::cast(object->length())->value();
Append('[');
switch (object->GetElementsKind()) {
« no previous file with comments | « build/common.gypi ('k') | test/mjsunit/json-recursive.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698