From c48aef0b653ba83452c97b1d1017869de2a846b9 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 21 Jan 2017 17:59:49 +0900 Subject: Stack position may be bigger than stack bottom; fix #3401 This issue was reported by https://hackerone.com/titanous --- src/vm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/vm.c') diff --git a/src/vm.c b/src/vm.c index c32fb0c0a..77372d937 100644 --- a/src/vm.c +++ b/src/vm.c @@ -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; -- cgit v1.2.3