summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-09-22 13:00:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-09-22 13:00:58 +0900
commit0ceaa0960af0b0150bc16da3d10a5e1ab0d3053b (patch)
tree5f3dd5bd624fe0b39e3038a2ec7fa936d70ee804 /src
parent5760226e71e2dbf87d31d8aad2d0cdaa0a18748a (diff)
downloadmruby-0ceaa0960af0b0150bc16da3d10a5e1ab0d3053b.tar.gz
mruby-0ceaa0960af0b0150bc16da3d10a5e1ab0d3053b.zip
`OP_EPOP` operand may be bigger than `mrb->c->eidx`; fix #3810
Diffstat (limited to 'src')
-rw-r--r--src/vm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vm.c b/src/vm.c
index 941105212..3c74f265c 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1327,7 +1327,9 @@ RETRY_TRY_BLOCK:
NEXT;
}
- for (n=0; n<a && mrb->c->eidx > epos; n++) {
+ if (a > mrb->c->eidx - epos)
+ a = mrb->c->eidx - epos;
+ for (n=0; n<a; n++) {
proc = mrb->c->ensure[epos+n];
irep = proc->body.irep;
ci = cipush(mrb);