summaryrefslogtreecommitdiffhomepage
path: root/src/vm.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-04-03 18:47:38 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-04-03 18:47:38 +0900
commitab63ee61ca2c130907d68d656ff7486ec2d29db8 (patch)
tree5c63f2077ed3b622689c98cb3cd2af64cffef49f /src/vm.c
parentb8461c86817fd2f766746e61e9f93362955a3474 (diff)
downloadmruby-ab63ee61ca2c130907d68d656ff7486ec2d29db8.tar.gz
mruby-ab63ee61ca2c130907d68d656ff7486ec2d29db8.zip
Fixed out-of-bounds access of `ensure[]`; ref #3491
Diffstat (limited to 'src/vm.c')
-rw-r--r--src/vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vm.c b/src/vm.c
index 87262f1be..bb4023da2 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1142,7 +1142,7 @@ RETRY_TRY_BLOCK:
p = mrb_closure_new(mrb, irep->reps[GETARG_Bx(i)]);
/* push ensure_stack */
- if (mrb->c->esize <= mrb->c->ci->eidx) {
+ if (mrb->c->esize <= mrb->c->ci->eidx+1) {
if (mrb->c->esize == 0) mrb->c->esize = 16;
else mrb->c->esize *= 2;
mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);