dvyukov/go-fuzz

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

naveensrinivasan opened this issue · 9 comments

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.

u, err := strconv.ParseUint(lit, 0, 64)

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

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?

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

How about in your code's dependencies?

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

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.

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

Thanks, is there any way I can ignore this?

You can try:

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

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

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.