internal/fuzz: use full int64/uint64 range in mutator

On 32-bit platforms maxInt and maxUint reflect the native int/uint size, so int64 and uint64 inputs were incorrectly bounded when mutating fuzz arguments.

Change-Id: I94c632cad1812ddfb0534ce6805be944d88166c5
GitHub-Last-Rev: 50037385ae
GitHub-Pull-Request: golang/go#78666
Reviewed-on: https://go-review.googlesource.com/c/go/+/765980
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
This commit is contained in:
Weixie Cui 2026-04-12 15:29:59 +00:00 committed by Gopher Robot
parent 620cefa291
commit 9a32e8ce07

View file

@ -66,7 +66,7 @@ func (m *mutator) mutate(vals []any, maxBytes int) {
case int16:
vals[i] = int16(m.mutateInt(int64(v), math.MaxInt16))
case int64:
vals[i] = m.mutateInt(v, maxInt)
vals[i] = m.mutateInt(v, math.MaxInt64)
case uint:
vals[i] = uint(m.mutateUInt(uint64(v), maxUint))
case uint16:
@ -74,7 +74,7 @@ func (m *mutator) mutate(vals []any, maxBytes int) {
case uint32:
vals[i] = uint32(m.mutateUInt(uint64(v), math.MaxUint32))
case uint64:
vals[i] = m.mutateUInt(v, maxUint)
vals[i] = m.mutateUInt(v, math.MaxUint64)
case float32:
vals[i] = float32(m.mutateFloat(float64(v), math.MaxFloat32))
case float64: