Skip to content
Myr

Fix crash in LOADVN when stack grows

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This `stack_push()` call in LOADVN invalidates `var`: jv* var = frame_local_var(jq, v, level); jv_free(stack_popn(jq)); ------>stack_push(jq, *var); *var = jv_null(); ^^^^^^ We have to re-compute `var`: jv* var = frame_local_var(jq, v, level); jv_free(stack_popn(jq)); stack_push(jq, *var); ------>var = frame_local_var(jq, v, level); *var = jv_null();

authored by Nicolas Williams · committed by Nicolas Williams · parent 07dc653 · Browse files · 1 file+4 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−0 removed

  • other:+4 added−0 removed

1 file+4 added−0 removed

modified:src/execute.c+4 added
559 unmodified lines
560 jv_dump(jv_copy(*var), 0);561 printf(" (%d)\n", jv_get_refcnt(*var));562 }563 jv_free(stack_popn(jq));564565 // This `stack_push()` invalidates the `var` reference, so566 stack_push(jq, *var);567 // we have to re-resolve `var` before we can set it to null568 var = frame_local_var(jq, v, level);569 *var = jv_null();570 break;571 }572
697 unmodified lines