aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatie Hockman <katie@golang.org>2020-11-10 15:54:12 -0500
committerKatie Hockman <katiehockman@google.com>2020-11-11 23:35:42 +0000
commit84150d0af193a7ccd733b3c7fa5787f43125cd2d (patch)
tree4a3a16d190157a2a9dc2cdbea151715ee665278d
parentec06b6d6be568ce1591d91a0ea4f14c190d06605 (diff)
downloadgo-84150d0af193a7ccd733b3c7fa5787f43125cd2d.tar.gz
go-84150d0af193a7ccd733b3c7fa5787f43125cd2d.zip
[release-branch.go1.15-security] math/big: fix shift for recursive division
The previous s value could cause a crash for certain inputs. Will check in tests and documentation improvements later. Thanks to the Go Ethereum team and the OSS-Fuzz project for reporting this. Thanks to Rémy Oudompheng and Robert Griesemer for their help developing and validating the fix. Fixes CVE-2020-28362 Change-Id: Ibbf455c4436bcdb07c84a34fa6551fb3422356d3 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/899974 Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Filippo Valsorda <valsorda@google.com> (cherry picked from commit 28015462c2a83239543dc2bef651e9a5f234b633) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901065
-rw-r--r--src/math/big/nat.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/big/nat.go b/src/math/big/nat.go
index 6a3989bf9d8..8c43de69d33 100644
--- a/src/math/big/nat.go
+++ b/src/math/big/nat.go
@@ -928,7 +928,7 @@ func (z nat) divRecursiveStep(u, v nat, depth int, tmp *nat, temps []*nat) {
// Now u < (v<<B), compute lower bits in the same way.
// Choose shift = B-1 again.
- s := B
+ s := B - 1
qhat := *temps[depth]
qhat.clear()
qhat.divRecursiveStep(u[s:].norm(), v[s:], depth+1, tmp, temps)