From 5c569095475d116b40f9c1854472cb96239e101d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 23 Jul 2025 15:38:04 +0300 Subject: [PATCH] strconv: fix bounds check bug, discovered by the equivalent of `./v -g -force-bounds-checking test vlib/toml/` (thanks to tankf33der) --- vlib/strconv/atoi.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/strconv/atoi.v b/vlib/strconv/atoi.v index 3073446dda..50b66ca917 100644 --- a/vlib/strconv/atoi.v +++ b/vlib/strconv/atoi.v @@ -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