Skip to content

Commit 84150d0

Browse files
committed
[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 <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]> (cherry picked from commit 28015462c2a83239543dc2bef651e9a5f234b633) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901065
1 parent ec06b6d commit 84150d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/math/big/nat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ func (z nat) divRecursiveStep(u, v nat, depth int, tmp *nat, temps []*nat) {
928928

929929
// Now u < (v<<B), compute lower bits in the same way.
930930
// Choose shift = B-1 again.
931-
s := B
931+
s := B - 1
932932
qhat := *temps[depth]
933933
qhat.clear()
934934
qhat.divRecursiveStep(u[s:].norm(), v[s:], depth+1, tmp, temps)

0 commit comments

Comments
 (0)