Stack position may be bigger than stack bottom; fix #3401

This issue was reported by https://hackerone.com/titanous
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-01-21 17:59:49 +09:00
parent 873b96bebc
commit c48aef0b65
+1
View File
@@ -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;