Skip to content

fix(avm-transpiler): check u16 operand narrowing#24119

Draft
Kuhai9801 wants to merge 4 commits into
AztecProtocol:nextfrom
Kuhai9801:fix-avm-u16-address-truncation
Draft

fix(avm-transpiler): check u16 operand narrowing#24119
Kuhai9801 wants to merge 4 commits into
AztecProtocol:nextfrom
Kuhai9801:fix-avm-u16-address-truncation

Conversation

@Kuhai9801

Copy link
Copy Markdown

Summary

Fixes #24115.

The AVM transpiler now checks Brillig memory addresses before encoding them as U16 operands instead of silently wrapping oversized values. The C ABI entrypoints convert transpilation panics into TranspileResult errors, so invalid inputs do not unwind across FFI.

The debug-log message-size immediate is also range-checked before U16 encoding.

Checklist

  • I've provided a paragraph or two giving a summary of the change in the description, including relevant motivation and context.
  • I've enabled auto-merge if the PR is ready to merge.
  • I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code.
  • Every change is related to the PR description.
  • I have linked this pull request to relevant issues.

Testing

  • git diff --check
  • Targeted source sweep for remaining to_u32() as u16 and message_size.0 as u16 narrowing

No local compile or test run; verification should run in CI.

@Kuhai9801 Kuhai9801 marked this pull request as ready for review June 16, 2026 11:33
@Kuhai9801 Kuhai9801 marked this pull request as draft June 16, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AVM transpiler wraps Brillig memory addresses into u16 operands

1 participant