]> Cypherpunks repositories - gostls13.git/commit
runtime: use 64 bit calculation in overLoadFactor
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 1 May 2017 14:36:43 +0000 (07:36 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 1 May 2017 17:35:57 +0000 (17:35 +0000)
commitb666f2860b2735eb61fe5a03dd90c3af8eed1ec3
tree6c53eba66fbeb19cabc50a3b4c83c2fcd07b9e88
parent00db0cbf8648ca5b856aa3bd0179d205e6626473
runtime: use 64 bit calculation in overLoadFactor

overLoadFactor used a uintptr for its calculations.
When the number of potential buckets was large,
perhaps due to a coding error or corrupt/malicious user input
leading to a very large map size hint,
this led to overflow on 32 bit systems.
This overflow resulted in an infinite loop.

Prevent it by always using a 64 bit calculation.

Updates #20195

Change-Id: Iaabc710773cd5da6754f43b913478cc5562d89a2
Reviewed-on: https://go-review.googlesource.com/42185
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/hashmap.go