@@ -3246,7 +3246,7 @@ class Interpreter {
32463246 } break ;
32473247 case FRAME_ARRAY_TO_JSON: {
32483248 assert (f.val .t == Value::ARRAY);
3249- const auto arr = static_cast <const HeapArray *>(stack.top ().val .v .h );
3249+ const auto arr = static_cast <HeapArray *>(stack.top ().val .v .h );
32503250 if (!f.first ) {
32513251 // We should have got here by coercing an array element to a string,
32523252 // leaving the JSON representation in scratch.
@@ -3266,6 +3266,8 @@ class Interpreter {
32663266 const auto thunk = arr->elements [f.elementId ];
32673267 const auto loc = f.location ;
32683268 const int indentLevel = (f.indentLevel == 0 ) ? 0 : f.indentLevel + 1 ;
3269+ // Add a call frame for the JSON conversion, used to apply depth limit.
3270+ stack.newCall (thunk->body ->location , arr, nullptr , 0 , BindingFrame{});
32693271 stack.newFrame (FRAME_TO_JSON, loc);
32703272 stack.top ().indentLevel = indentLevel;
32713273 if (thunk->filled ) {
@@ -3312,6 +3314,8 @@ class Interpreter {
33123314 const Identifier *ident = f.manifestFields .begin ()->second ;
33133315 const auto loc = f.location ;
33143316 const int indentLevel = (f.indentLevel == 0 ) ? 0 : f.indentLevel + 1 ;
3317+ // Add a call frame for the JSON conversion, used to apply depth limit.
3318+ stack.newCall (loc, obj, nullptr , 0 , BindingFrame{});
33153319 stack.newFrame (FRAME_TO_JSON, loc);
33163320 stack.top ().indentLevel = indentLevel;
33173321 // pushes FRAME_CALL
0 commit comments