Fixed wrong range condition in OP_JMPUW

fixed #6441
This commit is contained in:
dearblue
2024-12-03 22:14:50 +09:00
parent 4a99f28ec3
commit 95e2f8e844
2 changed files with 58 additions and 1 deletions
+1 -1
View File
@@ -1721,7 +1721,7 @@ RETRY_TRY_BLOCK:
if (irep->clen > 0 &&
(ch = catch_handler_find(irep, ci->pc, MRB_CATCH_FILTER_ENSURE))) {
/* avoiding a jump from a catch handler into the same handler */
if (a < mrb_irep_catch_handler_unpack(ch->begin) || a >= mrb_irep_catch_handler_unpack(ch->end)) {
if (a < mrb_irep_catch_handler_unpack(ch->begin) || a > mrb_irep_catch_handler_unpack(ch->end)) {
THROW_TAGGED_BREAK(mrb, RBREAK_TAG_JUMP, mrb->c->ci, mrb_fixnum_value(a));
}
}
+57
View File
@@ -71,6 +71,63 @@ assert('break', '11.5.2.4.3') do
end
end
assert_equal [1,2,3,4], a
a = []
begin
while true
a.push 1
break
a.push "NG"
end
ensure
a.push 2
end
assert_equal [1, 2], a
a = []
begin
while true
a.push 1
break
end
a.push 2
ensure
a.push 3
end
assert_equal [1, 2, 3], a
a = []
begin
while true
begin
a.push 1
break
ensure
a.push 2
end
a.push "NG"
end
ensure
a.push 3
end
assert_equal [1, 2, 3], a
a = []
begin
while true
begin
a.push 1
break
ensure
a.push 2
end
a.push "NG"
end
a.push 3
ensure
a.push 4
end
assert_equal [1, 2, 3, 4], a
end
assert('redo', '11.5.2.4.5') do