]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14-security] encoding/binary: read at most MaxVarintLen64 bytes...
authorKatie Hockman <katie@golang.org>
Tue, 4 Aug 2020 15:45:32 +0000 (11:45 -0400)
committerKatie Hockman <katiehockman@google.com>
Thu, 6 Aug 2020 13:03:14 +0000 (13:03 +0000)
commit51bb041f7cf17c5e8e10a7307521625437687b04
tree1ec0b06470b3a1ceefcb1683db60f256a480abb6
parentedfd6f28486017dcb136cd3f3ec252706d4b326e
[release-branch.go1.14-security] encoding/binary: read at most MaxVarintLen64 bytes in ReadUvarint

This CL ensures that ReadUvarint consumes only a limited
amount of input (instead of an unbounded amount).

On some inputs, ReadUvarint could read an arbitrary number
of bytes before deciding to return an overflow error.
After this CL, ReadUvarint returns that same overflow
error sooner, after reading at most MaxVarintLen64 bytes.

Fix authored by Robert Griesemer and Filippo Valsorda.

Thanks to Diederik Loerakker, Jonny Rhea, Raúl Kripalani,
and Preston Van Loon for reporting this.

Fixes CVE-2020-16845

Change-Id: Ie0cb15972f14c38b7cf7af84c45c4ce54909bb8f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/812099
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/812326
src/encoding/binary/varint.go
src/encoding/binary/varint_test.go