Repository navigation
[interp] Fix out-of-bounds read tracing call_ref and return_call_ref - #2819
Merged
Merged
Conversation
zherczeg
reviewed
Aug 11, 2026
| #0. 24: V:1 | i32.const 0 | ||
| #0. 32: V:2 | i32.const 0 | ||
| #0. 40: V:3 | i32.store $0:0+$0, 0 | ||
| #0. 56: V:1 | call_ref ? |
Contributor
Author
There was a problem hiding this comment.
Yes, that's expected. call_ref and return_call_ref carry no operand types in opcode.def (the params are all ___), so TraceSource::Pick works out num_operands as 0, treats the type as Void, and the switch on instr.op has no case for them, so it returns "?". Any opcode without recorded param types traces the same way. The value under it is the callee funcref, the tracer just has no static type to print for it. Showing funcref:N there would mean recording the operand type, which is the TODO already sitting above Pick. The point of this patch is only that the kind is set at all, so Pick(1) reads the real top of stack instead of a stale two-operand kind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Istream::Readnever initialisesInstr::kindforcall_ref/return_call_refthough both are emitted into the istream, so under--tracethe tracer decodes them with the previous instruction's kind andPick()reads past the end of the value stack; give themImm_0_Op_1(no immediate, one operand: the callee reference) like the other reachable opcodes.