Repository navigation
fix(dyn-abi): handle short data in decode_error without panicking - #1084
Merged
Merged
Conversation
The likely_unlikely feature was stabilized under core_intrinsics, which is already declared. The separate feature gate is no longer needed and causes a clippy error on newer nightly. Co-Authored-By: zerosnacks <[email protected]>
Co-Authored-By: zerosnacks <[email protected]>
Co-Authored-By: zerosnacks <[email protected]>
decode_error panicked with 'range end index 4 out of range for slice of length 0' when called with data shorter than 4 bytes, because the SelectorMismatch error branch unconditionally sliced data[0..4]. Zero-pad short data instead of panicking. Co-Authored-By: zerosnacks <[email protected]>
Co-Authored-By: zerosnacks <[email protected]>
decofe
force-pushed
the
zerosnacks/fix-decode-error-panic-short-data
branch
from
March 16, 2026 08:16
32d14f6 to
299d4c0
Compare
zerosnacks
changed the base branch from
main
to
zerosnacks/fix-unused-likely-unlikely-feature
March 16, 2026 08:29
zerosnacks
marked this pull request as ready for review
March 16, 2026 08:29
Base automatically changed from
zerosnacks/fix-unused-likely-unlikely-feature
to
main
March 16, 2026 11:11
onbjerg
approved these changes
Mar 17, 2026
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.
Summary
DynSolError::decode_errorpanics when called with data shorter than 4 bytes.Motivation
The
SelectorMismatcherror branch unconditionally slicesdata[0..4]to extract the actual selector, butdatamay be shorter than 4 bytes (or empty). This causes a panic:range end index 4 out of range for slice of length 0.Discovered via foundry-rs/foundry#13766 where
vm.expectRevert(bytes(""))triggers this panic.Changes
SelectorMismatcherror instead of panickingTesting
All 3 tests pass (including the new
decode_error_short_datatest).Co-Authored-By: zerosnacks [email protected]
Prompted by: zerosnacks