Skip invalid Slither constants during value seeding#831
Open
0xjoma wants to merge 1 commit intocrytic:masterfrom
Open
Skip invalid Slither constants during value seeding#8310xjoma wants to merge 1 commit intocrytic:masterfrom
0xjoma wants to merge 1 commit intocrytic:masterfrom
Conversation
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.
Description
Fixes a startup panic in Slither-backed value seeding.
SeedFromSlitherignored theokresult frombig.Int.SetStringin both the integer and address branches. If Slither emits a numeric- or address-typed constant whose value is not a valid base-10 string, Medusa passed a nil*big.Intinto downstream value-seeding code and panicked:(*big.Int).Neg(nil)for the integer branch andcommon.BigToAddress(nil) -> b.Bytes()for the address branch.This change keeps the existing decimal-only parsing behavior and skips constants that cannot be parsed.
Related Issues: Closes #830
Type of Change:
Testing
Run inside a fresh clone on
dev/slither-seed-parse-failure:The new test
TestSeedFromSlitherInvalidUintDoesNotPanicpanics on stockmasteratvalue_set_from_slither.go:19andTestSeedFromSlitherInvalidAddressDoesNotPanicpanics at line 35; both pass after the patch.Additional Context
0xparsing is intentionally not added in this PR to keep the bug fix separable from a behavior expansion. The existing AST-based seed path invalue_set_from_ast.goalready handles0x-prefixed numeric values; whether the Slither-based path should match it is a separate discussion.Outstanding TODOs
None.