mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
strconv: fix bounds check bug, discovered by the equivalent of ./v -g -force-bounds-checking test vlib/toml/
(thanks to tankf33der)
This commit is contained in:
parent
2eacc6fadb
commit
5c56909547
@ -46,7 +46,7 @@ pub fn common_parse_uint2(s string, _base int, _bit_size int) (u64, int) {
|
||||
// Look for octal, binary and hex prefix.
|
||||
base = 10
|
||||
if s[0] == `0` {
|
||||
ch := s[1] | 32
|
||||
ch := if s.len > 1 { s[1] | 32 } else { `0` }
|
||||
if s.len >= 3 {
|
||||
if ch == `b` {
|
||||
base = 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user