[bugfix] calling dead escape continuation causes segv

This commit is contained in:
Yuichi Nishiwaki
2015-06-02 06:01:16 +09:00
parent 1e3bb6f1bb
commit dbcd81c8c1
8 changed files with 38 additions and 27 deletions
+6
View File
@@ -3,6 +3,8 @@
struct pic_cont {
jmp_buf jmp;
pic_jmpbuf *prev_jmp;
struct pic_winder *wind;
char *stk_pos, *stk_ptr;
@@ -115,6 +117,8 @@ save_cont(pic_state *pic, struct pic_cont **c)
cont = *c = pic_malloc(pic, sizeof(struct pic_cont));
cont->prev_jmp = pic->jmp;
cont->wind = pic->wind;
cont->stk_len = native_stack_length(pic, &pos);
@@ -170,6 +174,8 @@ restore_cont(pic_state *pic, struct pic_cont *cont)
if (&v > cont->stk_pos + cont->stk_len) native_stack_extend(pic, cont);
}
pic->jmp = cont->prev_jmp;
pic->wind = cont->wind;
pic->stbase = pic_realloc(pic, pic->stbase, sizeof(pic_value) * cont->st_len);