Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
naveensrinivasan opened this issue Dec 5, 2021 · 9 comments

Comments

@naveensrinivasan
Copy link

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?

@josharian
Copy link
Collaborator

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?

@naveensrinivasan
Copy link
Author

naveensrinivasan commented Dec 5, 2021

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

@josharian
Copy link
Collaborator

How about in your code's dependencies?

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

@naveensrinivasan
Copy link
Author

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.

@thepudds
Copy link
Collaborator

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

@naveensrinivasan
Copy link
Author

Thanks, is there any way I can ignore this?

@thepudds
Copy link
Collaborator

You can try:

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

@thepudds thepudds changed the title go-fuzz-build fails go-fuzz-build fails for cuelang.org with 'failed to parse int literal ... value out of range' for very large number Dec 26, 2021
@MariusVanDerWijden
Copy link

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

@josharian
Copy link
Collaborator

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.

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

No branches or pull requests

4 participants