Skip to content

[mlir][Sol] Update checks in ABI decode#41

Merged
vladimirradosavljevic merged 5 commits intomainfrom
mlir_update_checks_in_abi_decode
Mar 18, 2026
Merged

[mlir][Sol] Update checks in ABI decode#41
vladimirradosavljevic merged 5 commits intomainfrom
mlir_update_checks_in_abi_decode

Conversation

@vladimirradosavljevic
Copy link
Copy Markdown
Contributor

@vladimirradosavljevic vladimirradosavljevic commented Mar 17, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Solidity-to-Standard lowering utilities to harden ABI tuple decoding and dynamic memory allocation against malformed offsets/lengths by adding additional bounds checks and a configurable length guard during dynamic allocations.

Changes:

  • Extend genMemAllocForDynArray with an optional genLengthPanicGuard that panics on lengths exceeding type(uint64).max.
  • Add new tuple-bounds helper checks to ABI tuple decoding and apply them to array/string decoding paths.
  • Adjust revert reasons and add a trailing-bytes canonicalization store after decoding/copying strings into memory.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
mlir/lib/Conversion/SolToStandard/EVMUtil.cpp Adds new decoding bounds-check helpers, tightens tuple decoding checks, and introduces an optional length panic guard for dynamic allocations.
mlir/include/mlir/Conversion/SolToStandard/EVMUtil.h Updates the genMemAllocForDynArray API to accept an optional length guard parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

… types

This change adds the missing tuple word-range and fixed-array
stride bounds checks in MLIR ABI decoding so array/string
decode paths correctly revert on out-of-bounds inputs.

Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
… decoding

Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
@vladimirradosavljevic vladimirradosavljevic force-pushed the mlir_update_checks_in_abi_decode branch from 8d4697f to 94a5ca0 Compare March 18, 2026 09:47
Copy link
Copy Markdown
Contributor

@PavelKopyl PavelKopyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@vladimirradosavljevic vladimirradosavljevic merged commit c2e831a into main Mar 18, 2026
12 of 17 checks passed
@vladimirradosavljevic vladimirradosavljevic deleted the mlir_update_checks_in_abi_decode branch March 18, 2026 13:30
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.

4 participants