1
0
mirror of https://github.com/golang/go synced 2024-11-21 15:04:44 -07:00

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

R=r, rsc
CC=golang-dev
https://golang.org/cl/2144043
This commit is contained in:
Anthony Martin 2010-09-06 08:04:53 +10:00 committed by Rob Pike
parent d54b921c9b
commit 68cce4ab20
2 changed files with 4 additions and 1 deletions

View File

@ -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:

View File

@ -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{