Commit 68cce4ab authored by Anthony Martin's avatar Anthony Martin Committed by Rob Pike

fmt.Scan: fix integer overflow on 32-bit machines

R=r, rsc
CC=golang-dev
https://golang.org/cl/2144043
parent d54b921c
......@@ -740,7 +740,7 @@ func (s *ss) scanOne(verb int, field interface{}) {
case *int32:
*v = int32(s.scanInt(verb, 32))
case *int64:
*v = s.scanInt(verb, intBits)
*v = s.scanInt(verb, 64)
case *uint:
*v = uint(s.scanUint(verb, intBits))
case *uint8:
......
......@@ -183,6 +183,9 @@ var scanTests = []ScanTest{
// Custom scanner.
ScanTest{" vvv ", &xVal, Xs("vvv")},
// Fixed bugs
ScanTest{"2147483648\n", &int64Val, int64(2147483648)}, // was: integer overflow
}
var scanfTests = []ScanfTest{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment