crypto/sha1: on 32-bit platforms, panic trying to Sum after a large amount of data hashed #29543
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
(Note: this is the same problem as in #29517, but in the crypto/sha1 package. Fix will be similar)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
Note: the issue only occurs targeting architectures for which an
int
is 32 bits. I can easily trigger the problem by building with GOARCH=386.What did you do?
Hash a large amount of data (length large than a platform int), save the hash using
binary.Marshal
, restore it usingbinary.Unmarshal
, and then try toSum
it.This play.golang.org link contains a simple example that triggers the issue:
https://play.golang.org/p/-OELF0xAvll
When I run it there, the arch I see is amd64p32, so the issue occurs.
What did you expect to see?
I expect to be able to successfully get a checksum for the unmarshaled sha1 without panic.
What did you see instead?
Upon calling
h.Sum(nil)
, I get a panic similar to:Possible resolution
Fix cast in unmarshal code (as in #29517)
The text was updated successfully, but these errors were encountered: