mirror of
https://github.com/golang/go
synced 2024-11-21 21:24:45 -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:
parent
d54b921c9b
commit
68cce4ab20
@ -740,7 +740,7 @@ func (s *ss) scanOne(verb int, field interface{}) {
|
|||||||
case *int32:
|
case *int32:
|
||||||
*v = int32(s.scanInt(verb, 32))
|
*v = int32(s.scanInt(verb, 32))
|
||||||
case *int64:
|
case *int64:
|
||||||
*v = s.scanInt(verb, intBits)
|
*v = s.scanInt(verb, 64)
|
||||||
case *uint:
|
case *uint:
|
||||||
*v = uint(s.scanUint(verb, intBits))
|
*v = uint(s.scanUint(verb, intBits))
|
||||||
case *uint8:
|
case *uint8:
|
||||||
|
@ -183,6 +183,9 @@ var scanTests = []ScanTest{
|
|||||||
|
|
||||||
// Custom scanner.
|
// Custom scanner.
|
||||||
ScanTest{" vvv ", &xVal, Xs("vvv")},
|
ScanTest{" vvv ", &xVal, Xs("vvv")},
|
||||||
|
|
||||||
|
// Fixed bugs
|
||||||
|
ScanTest{"2147483648\n", &int64Val, int64(2147483648)}, // was: integer overflow
|
||||||
}
|
}
|
||||||
|
|
||||||
var scanfTests = []ScanfTest{
|
var scanfTests = []ScanfTest{
|
||||||
|
Loading…
Reference in New Issue
Block a user