Skip to content

Instantly share code, notes, and snippets.

@MariusVanDerWijden
Created May 26, 2020 08:15
Show Gist options
  • Save MariusVanDerWijden/0a151f12e8cd1dc70f919e5886749a7e to your computer and use it in GitHub Desktop.
Save MariusVanDerWijden/0a151f12e8cd1dc70f919e5886749a7e to your computer and use it in GitHub Desktop.

Hey, I'm currently trying to fuzz a library that was generated from rust and run into an Could not import C (no metadata for C) error.

I found these prs to golang: https://go-review.googlesource.com/c/tools/+/214738/ https://go-review.googlesource.com/c/tools/+/214943/ The second one was merged into master (but not included in the latest release). I also tried to apply the first one, however this gives me multiple undeclared name: C errors.

The library is here: https://github.com/shamatar/eip2537rustwrapper Repro:

  • clone the library,
  • execute the functions in their readme
  • edit package from main -> bls in lib.go
  • Change the library path to a real path e.g. // #cgo LDFLAGS: -L/home/matematik/go/src/github.com/ethereum/go-ethereum/tests/fuzzers/bls12381/eip2637rustwrapper/libs -leth_pairings -lm -ldl
  • add func Fuzz(data []byte) int { return 1 } to lib.go
  • run go-fuzz-build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment