Skip to content

Commit

Permalink
Stack position may be bigger than stack bottom; fix #3401
Browse files Browse the repository at this point in the history
This issue was reported by https://hackerone.com/titanous
  • Loading branch information
matz committed Jan 21, 2017
1 parent 873b96b commit c48aef0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/vm.c
Expand Up @@ -137,6 +137,7 @@ stack_extend_alloc(mrb_state *mrb, int room, int keep)
size_t size = mrb->c->stend - mrb->c->stbase;
size_t off = mrb->c->stack - mrb->c->stbase;

if (off > size) size = off;
#ifdef MRB_STACK_EXTEND_DOUBLING
if (room <= size)
size *= 2;
Expand Down

0 comments on commit c48aef0

Please sign in to comment.