aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/ratconv.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-02-11 14:58:56 +0000
committerCherry Mui <cherryyz@google.com>2022-02-11 14:58:56 +0000
commite90b835f3071f1eb71810a3631b792f23df59f24 (patch)
treedc5a1c1620f14dbc051402095af9c024bc12a202 /src/math/big/ratconv.go
parentbb93480d009322886df6f5185c988d6d21fdc2c8 (diff)
parent0a6cf8706fdd0fe1bd26e4d1ecbcd41650bf5e6c (diff)
downloadgo-e90b835f3071f1eb71810a3631b792f23df59f24.tar.gz
go-e90b835f3071f1eb71810a3631b792f23df59f24.zip
[dev.boringcrypto.go1.16] all: merge go1.16.14 into dev.boringcrypto.go1.16
Change-Id: I186a567b3e76df7ecf1842634a3851eab7c9dfce
Diffstat (limited to 'src/math/big/ratconv.go')
-rw-r--r--src/math/big/ratconv.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/math/big/ratconv.go b/src/math/big/ratconv.go
index ac3c8bd11f..90053a9c81 100644
--- a/src/math/big/ratconv.go
+++ b/src/math/big/ratconv.go
@@ -169,6 +169,11 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
n := exp5
if n < 0 {
n = -n
+ if n < 0 {
+ // This can occur if -n overflows. -(-1 << 63) would become
+ // -1 << 63, which is still negative.
+ return nil, false
+ }
}
if n > 1e6 {
return nil, false // avoid excessively large exponents