• Martin Möhrmann's avatar
    strconv: fix ParseUint return value on range overflow · fc6b74ce
    Martin Möhrmann authored
    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: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
    fc6b74ce
atoi.go 4.59 KB