1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

strconv: fix atoi returning 0 on large strings (#10635)

This commit is contained in:
Flinner
2021-07-02 10:39:57 +03:00
committed by GitHub
parent abbf71c794
commit 1486258591
6 changed files with 62 additions and 52 deletions

View File

@@ -159,7 +159,7 @@ fn (mut s Scanner) text_scan() Token {
if codepoint.len != 4 {
return s.error('unicode escape must have 4 hex digits')
}
val := u32(strconv.parse_uint(codepoint.bytestr(), 16, 32))
val := u32(strconv.parse_uint(codepoint.bytestr(), 16, 32) or { 0 })
converted := utf32_to_str(val)
converted_bytes := converted.bytes()
chrs << converted_bytes