@@ -3333,7 +3333,7 @@ class Interpreter {
33333333 } break ;
33343334 case FRAME_ARRAY_TO_JSON: {
33353335 assert (f.val .t == Value::ARRAY);
3336- const auto arr = static_cast <const HeapArray *>(stack.top ().val .v .h );
3336+ const auto arr = static_cast <HeapArray *>(stack.top ().val .v .h );
33373337 if (!f.first ) {
33383338 // We should have got here by coercing an array element to a string,
33393339 // leaving the JSON representation in scratch.
@@ -3353,6 +3353,8 @@ class Interpreter {
33533353 const auto thunk = arr->elements [f.elementId ];
33543354 const auto loc = f.location ;
33553355 const int indentLevel = (f.indentLevel == 0 ) ? 0 : f.indentLevel + 1 ;
3356+ // Add a call frame for the JSON conversion, used to apply depth limit.
3357+ stack.newCall (thunk->body ->location , arr, nullptr , 0 , BindingFrame{});
33563358 stack.newFrame (FRAME_TO_JSON, loc);
33573359 stack.top ().indentLevel = indentLevel;
33583360 if (thunk->filled ) {
@@ -3399,6 +3401,8 @@ class Interpreter {
33993401 const Identifier *ident = f.manifestFields .begin ()->second ;
34003402 const auto loc = f.location ;
34013403 const int indentLevel = (f.indentLevel == 0 ) ? 0 : f.indentLevel + 1 ;
3404+ // Add a call frame for the JSON conversion, used to apply depth limit.
3405+ stack.newCall (loc, obj, nullptr , 0 , BindingFrame{});
34023406 stack.newFrame (FRAME_TO_JSON, loc);
34033407 stack.top ().indentLevel = indentLevel;
34043408 // pushes FRAME_CALL
0 commit comments