cryptobyte: fix parsing of large ASN.1 OIDs
Fixes golang/go#49678 Change-Id: If8a40e25edd810a66165ab78dd68d9b7fc2699f8 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/365674 Reviewed-by: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> Trust: Alex Rakoczy <alex@golang.org> Trust: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
committed by
Filippo Valsorda
parent
4570a0811e
commit
e495a2d5b3
+6
-1
@@ -407,7 +407,12 @@ func (s *String) ReadASN1Enum(out *int) bool {
|
||||
func (s *String) readBase128Int(out *int) bool {
|
||||
ret := 0
|
||||
for i := 0; len(*s) > 0; i++ {
|
||||
if i == 4 {
|
||||
if i == 5 {
|
||||
return false
|
||||
}
|
||||
// Avoid overflowing int on a 32-bit platform.
|
||||
// We don't want different behavior based on the architecture.
|
||||
if ret >= 1<<(31-7) {
|
||||
return false
|
||||
}
|
||||
ret <<= 7
|
||||
|
||||
Reference in New Issue
Block a user