Commit a41f5eb2 authored by Jurriaan Pruis's avatar Jurriaan Pruis

Fix segfault found using afl-fuzz

parent f39a31a6
...@@ -2652,13 +2652,17 @@ loop_break(codegen_scope *s, node *tree) ...@@ -2652,13 +2652,17 @@ loop_break(codegen_scope *s, node *tree)
} }
loop = s->loop; loop = s->loop;
while (loop->type == LOOP_BEGIN) { while (loop && loop->type == LOOP_BEGIN) {
genop_peep(s, MKOP_A(OP_POPERR, 1), NOVAL); genop_peep(s, MKOP_A(OP_POPERR, 1), NOVAL);
loop = loop->prev; loop = loop->prev;
} }
while (loop->type == LOOP_RESCUE) { while (loop && loop->type == LOOP_RESCUE) {
loop = loop->prev; loop = loop->prev;
} }
if (!loop) {
codegen_error(s, "unexpected break");
}
if (loop->type == LOOP_NORMAL) { if (loop->type == LOOP_NORMAL) {
int tmp; int tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment