Skip to content

Commit e4f534b

Browse files
create a FRAME_CALL for nested objects being manifested (to apply stack limits)
1 parent b4ee10b commit e4f534b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

core/vm.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)