[bugfix] rhs of assignment may modify lhs pointer

This commit is contained in:
Yuichi Nishiwaki 2014-08-13 14:44:00 +09:00
parent c7f3346be6
commit 8039ddf9c5
1 changed files with 3 additions and 1 deletions

View File

@ -775,9 +775,11 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
ci->fp = pic->sp - c.u.i; ci->fp = pic->sp - c.u.i;
ci->env = NULL; ci->env = NULL;
if (pic_proc_func_p(pic_proc_ptr(x))) { if (pic_proc_func_p(pic_proc_ptr(x))) {
pic_value *sp;
/* invoke! */ /* invoke! */
pic->sp[0] = proc->u.func.f(pic); sp = pic->sp;
sp[0] = proc->u.func.f(pic);
pic->sp += pic->ci->retc; pic->sp += pic->ci->retc;
pic_gc_arena_restore(pic, ai); pic_gc_arena_restore(pic, ai);