Skip to content

Automatic Library Linking causes crash when used in combination with predeployedContracts #655

@GalloDaSballo

Description

@GalloDaSballo

Impact

When using medusa with:

  • A library that requires linking
  • a predeployed target contract

Medusa crashes with the following logs:

panic: unable to parse init bytecode for contract CryticTester 


goroutine 1 [running]:
github.com/crytic/medusa/compilation/types.(*CompiledContract).LinkBytecodes(0x14006b8ea08, {0x1400592d4e4, 0xc}, 0x102073cd0?)
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/compilation/types/compiled_contract.go:173 +0x1d0
github.com/crytic/medusa/fuzzing.(*Fuzzer).deployContract(0x1400019b408, 0x14007528dc0, 0x14006b78e80, {0x1400040ee08, 0x0, 0x0}, 0x1400751e680, 0x0?)
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/fuzzing/fuzzer.go:635 +0x60
github.com/crytic/medusa/fuzzing.chainSetupFromCompilations(0x1400019b408, 0x14007528dc0)
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/fuzzing/fuzzer.go:606 +0xba8
github.com/crytic/medusa/fuzzing.(*Fuzzer).Start(0x1400019b408)
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/fuzzing/fuzzer.go:915 +0x5dc
github.com/crytic/medusa/cmd.cmdRunFuzz(0x102f82d20, {0x102fc1c00?, 0x4?, 0x1026e6162?})
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/cmd/fuzz.go:168 +0x774
github.com/spf13/cobra.(*Command).execute(0x102f82d20, {0x102fc1c00, 0x0, 0x0})
        /Users/entreprenerd2/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x844
github.com/spf13/cobra.(*Command).ExecuteC(0x102f827a0)
        /Users/entreprenerd2/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x384
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/entreprenerd2/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/crytic/medusa/cmd.Execute()
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/cmd/root.go:30 +0x60
main.main()
        /Users/entreprenerd2/go/pkg/mod/github.com/crytic/medusa@v1.3.0/main.go:12 +0x1c

Repro

Just run medusa fuzz on this:

https://github.com/GalloDaSballo/medusa-predeployedContracts-libs-crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions