Skip to content

Skip invalid Slither constants during value seeding#831

Open
0xjoma wants to merge 1 commit intocrytic:masterfrom
0xjoma:dev/slither-seed-parse-failure
Open

Skip invalid Slither constants during value seeding#831
0xjoma wants to merge 1 commit intocrytic:masterfrom
0xjoma:dev/slither-seed-parse-failure

Conversation

@0xjoma
Copy link
Copy Markdown

@0xjoma 0xjoma commented May 6, 2026

Description

Fixes a startup panic in Slither-backed value seeding.

SeedFromSlither ignored the ok result from big.Int.SetString in 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.Int into downstream value-seeding code and panicked: (*big.Int).Neg(nil) for the integer branch and common.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:

  • Bug Fix
  • Tests

Testing

Run inside a fresh clone on dev/slither-seed-parse-failure:

go fmt ./...
go vet ./fuzzing/valuegeneration/
go test ./fuzzing/valuegeneration/
go test ./...
golangci-lint run --timeout 5m0s

The new test TestSeedFromSlitherInvalidUintDoesNotPanic panics on stock master at value_set_from_slither.go:19 and TestSeedFromSlitherInvalidAddressDoesNotPanic panics at line 35; both pass after the patch.

Additional Context

0x parsing is intentionally not added in this PR to keep the bug fix separable from a behavior expansion. The existing AST-based seed path in value_set_from_ast.go already handles 0x-prefixed numeric values; whether the Slither-based path should match it is a separate discussion.

Outstanding TODOs

None.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 6, 2026

CLA assistant check
All committers have signed the CLA.

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]: SeedFromSlither panics on unparsable Slither constants

2 participants