]> Cypherpunks repositories - gostls13.git/commit
strconv: fix ParseUint return value on range overflow
authorMartin Möhrmann <moehrmann@google.com>
Sat, 12 Aug 2017 18:11:55 +0000 (20:11 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Sun, 13 Aug 2017 09:11:32 +0000 (09:11 +0000)
commitfc6b74ce39748efc360afea4164c92a710ad6e77
tree55f060933969f3a05a0fc07df7d1f797100c4470
parent1d81251599fd1b8f9da888e10c1054c96d1e1fb1
strconv: fix ParseUint return value on range overflow

If the value corresponding to the input string cannot be
represented by an unsigned integer of the given size,
err.Err = ErrRange and the returned value is the maximum
magnitude unsigned integer of the appropriate bitSize.
This is consistent with ParseInt's behavior and the documentation.

Expand tests to test 32 bit test value tables with bitsize 32 set.
These tests fail without the fix in this CL.

Fixes #21278

Change-Id: I8aab39279ec3e31905fcbf582a916cbf6d9b95da
Reviewed-on: https://go-review.googlesource.com/55134
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
src/strconv/atoi.go
src/strconv/atoi_test.go