diff options
author | Katie Hockman <katie@golang.org> | 2020-11-10 15:54:12 -0500 |
---|---|---|
committer | Katie Hockman <katie@golang.org> | 2020-11-12 20:42:40 +0000 |
commit | 1e1fa5903b760c6714ba17e50bf850b01f49135c (patch) | |
tree | 99c236777e152cea208b785f6263f0b41bb540a1 /src/math | |
parent | b34b0aaf69349f060d3b03a06f520848964cb7eb (diff) | |
download | go-1e1fa5903b760c6714ba17e50bf850b01f49135c.tar.gz go-1e1fa5903b760c6714ba17e50bf850b01f49135c.zip |
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>
Reviewed-on: https://go-review.googlesource.com/c/go/+/269657
Trust: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/big/nat.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/big/nat.go b/src/math/big/nat.go index c2f3787848..068176e1c1 100644 --- a/src/math/big/nat.go +++ b/src/math/big/nat.go @@ -929,7 +929,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) |