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

go-fuzz-build fails on golang.org/x/exp/rand

Open GuySirton opened this issue 6 years ago • 6 comments

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

https://github.com/golang/exp/blob/master/rand/rng.go#L29

Is a very large looking constant in this file.

GuySirton avatar May 17 '19 23:05 GuySirton

Thanks! Good find. I have some significant changes queued for int literal collection. I’ll be sure to fix this in the process.

josharian avatar May 17 '19 23:05 josharian

@josharian do you think it's possible to handle all possible consts in all contexts correctly? As far as I remember I just shuffled the code until it started compiling all packages that I was interested in.

dvyukov avatar May 18 '19 07:05 dvyukov

@dvyukov I do. There are a few design decisions to be made relating to effective fuzzing that I don't know the answers to, but you might. I will start a new issue to discuss.

josharian avatar May 19 '19 18:05 josharian

@josharian what's the status on this? i ran into this same issue today, and have implemented a quick-and-dirty hack to get around it, and would be happy to submit a PR if there's not a more principled approach coming down the pike.

hrb90 avatar Oct 17 '19 21:10 hrb90

There is no principled fix imminent. I’d be happy to look at a workaround PR, although I can’t guarantee it’d be merged. :)

josharian avatar Oct 17 '19 21:10 josharian

Hi there, I'm just trying to get started with fuzz-testing a project I maintain.

However, I hit the very same issue when trying to run go-fuzz-build on a package I want to fuzz, because one of its dependencies uses golang.org/x/exp/rand.

Is there a workaround I could employ for this error?

jannfis avatar Dec 15 '21 13:12 jannfis

Recently, I encountered a similar problem. After debugging, I found that the strconv.ParseUint function in the strconv package cannot handle the large number '47026247687942121848144207491837523525' which included in golang.org/x/exp/rand/rng.go. One possible solution is to use the -preserve flag with the golang.org/x/exp/rand package. However, please note that using -preserve=golang.org/x/exp may not be effective.

Aiiimer avatar Dec 13 '23 07:12 Aiiimer