go-fuzz icon indicating copy to clipboard operation
go-fuzz copied to clipboard

go-fuzz-build fails for cuelang.org with 'failed to parse int literal ... value out of range' for very large number

Open naveensrinivasan opened this issue 3 years ago • 9 comments
trafficstars

The go-fuzz-build fails with this.

failed to parse int literal '1000000000000000000000000000000000000000000000000000000000000000': strconv.ParseUint: parsing "1000000000000000000000000000000000000000000000000000000000000000": value out of range

I am guessing probably in this line. https://github.com/dvyukov/go-fuzz/blob/b1f3d6f4ef4e0fab65fa66f9191e6b115ad34f31/go-fuzz-build/cover.go#L427

Any idea as to what could be the issue and how to avoid it?

naveensrinivasan avatar Dec 05 '21 19:12 naveensrinivasan

Is there a literal 1000000000000000000000000000000000000000000000000000000000000000 in your source code? Is it part of a larger constant expression? Can you share the relevant line of code?

josharian avatar Dec 05 '21 19:12 josharian

None in my code. https://github.com/naveensrinivasan/cosign/blob/naveen/feat/fuzz-sget/test/fuzz/sget/fuzz.go pwd /home/sammy/go/src/github.com/naveensrinivasan/cosign/test/fuzz/sget go-fuzz-build . failed to parse int literal '1000000000000000000000000000000000000000000000000000000000000000': strconv.ParseUint: parsing "1000000000000000000000000000000000000000000000000000000000000000": value out of range

Thanks

naveensrinivasan avatar Dec 05 '21 20:12 naveensrinivasan

How about in your code's dependencies?

We might want to add position information to these errors (cc @thepudds).

josharian avatar Dec 05 '21 21:12 josharian

How about in your code's dependencies?

We might want to add position information to these errors (cc @thepudds).

TBH! I don't know which one has. If I knew I would probably include that in the exclude list.

naveensrinivasan avatar Dec 06 '21 01:12 naveensrinivasan

Hi @naveensrinivasan, just a quick comment for now, but one way to check your dependencies is to do go mod vendor, and then do a recursive grep of resulting ./vendor dir.

In this case, it looks like it is coming from your CUE dependency?

./vendor/cuelang.org/go/pkg/math/math.go:       Log2E  = 1000000000000000000000000000000000000000000000000000000000000000 / 693147180559945309417232121458176568075500134360255254120680009

thepudds avatar Dec 26 '21 14:12 thepudds

Thanks, is there any way I can ignore this?

naveensrinivasan avatar Dec 26 '21 14:12 naveensrinivasan

You can try:

go-fuzz-build -preserve=cuelang.org/go/pkg/math

thepudds avatar Dec 26 '21 14:12 thepudds

Ran into the same issue but with golang/x/exp/rand L33 produces

failed to parse int literal '47026247687942121848144207491837523525': strconv.ParseUint: parsing "47026247687942121848144207491837523525": value out of range
exit status 1

MariusVanDerWijden avatar Mar 29 '23 11:03 MariusVanDerWijden

Given that this is only used to generate literals, the right answer here, or at least the expedient answer, is to simply ignore the error if it occurs and keep ongoing. It should be a very simple PR; I'm willing to review it if anyone wants to send it.

josharian avatar Mar 29 '23 18:03 josharian