math/big: fix spurious race in Rat.Denom, Float.SetRat
Rat maintains the invariant that x.b.neg is always false, but Rat.Denom was writing x.b.neg = false itself too. That makes Rat.Denom a writing operation, when it should be a read-only operation. That in turn makes it unsafe to use from multiple goroutines, which is highly unexpected. Make it read-only and therefore race-free again. Fixes #50473. Change-Id: I97b87913954511e5200c0665d16b9ed63422e505 Reviewed-on: https://go-review.googlesource.com/c/go/+/375935 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by:Robert Griesemer <gri@golang.org>
Loading
Please sign in to comment