Skip to content

Commit f885c81

Browse files
committed
wasm-interp: Fix off-by-one in DoThrow
1 parent b15a13e commit f885c81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/interp/interp.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2615,7 +2615,8 @@ RunResult Thread::DoThrow(Exception::Ptr exn) {
26152615
auto iter = handlers.rbegin();
26162616
while (iter != handlers.rend()) {
26172617
const HandlerDesc& handler = *iter;
2618-
if (pc >= handler.try_start_offset && pc < handler.try_end_offset) {
2618+
// pc points to the *next* instruction by the time we're in DoThrow.
2619+
if (pc > handler.try_start_offset && pc <= handler.try_end_offset) {
26192620
// For a try-delegate, skip part of the traversal by directly going
26202621
// up to an outer handler specified by the delegate depth.
26212622
if (handler.kind == HandlerKind::Delegate) {

0 commit comments

Comments
 (0)