You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
math/big: Float.GobDecode accepts an invalid form that panics in Int64, Float64, Int, and Rat #81695
The same bytes decode the same way through a gob.Decoder reading from a stream.
What did you see happen?
GobDecode returns nil, and Int64, Float64, Int and Rat panic with unreachable.
The decoded value is inconsistent in other ways too: String returns "0" while Sign returns 1.
What did you expect to see?
An error from GobDecode. The form field has three valid values (zero, finite, inf), and validate0, added for #57946, only checks the mantissa and precision of a finite value. Int.GobDecode (#81490) and Rat.GobDecode (#81645) were fixed recently for the same kind of state that decodes without an error and panics later.
Activity
gopherbot commentedon Sep 23, 2026
Change https://go.dev/cl/837225 mentions this issue:
math/big: reject an invalid form in Float.GobDecodegabyhelp commentedon Sep 23, 2026
Related Issues
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
math/big: reject invalid mode, accuracy, and form in Float.GobDecode