Skip to content

Commit

Permalink
engine: call FunctionListener.Abort in correct order (#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso authored Jun 2, 2023
1 parent 51d0271 commit 50394cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions internal/engine/compiler/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,7 @@ func (ce *callEngine) deferredOnCall(ctx context.Context, m *wasm.ModuleInstance
}

err = builder.FromRecovered(recovered)
// Call listeners in revers order since they were captured while
// rewinding the call stack.
for i := len(functionListeners) - 1; i >= 0; i-- {
for i := range functionListeners {
functionListeners[i].Abort(ctx, m, functionListeners[i].def, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/engine/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (ce *callEngine) recoverOnCall(ctx context.Context, m *wasm.ModuleInstance,
}

err = builder.FromRecovered(v)
for i := len(functionListeners) - 1; i >= 0; i-- {
for i := range functionListeners {
functionListeners[i].Abort(ctx, m, functionListeners[i].def, err)
}

Expand Down

0 comments on commit 50394cc

Please sign in to comment.