Skip to content

Commit 28422d9

Browse files
authored
manually insert \0 for parseutils array passed to strtod (#1032)
refs #1023 The array is not zeroed out in nimony AFAIK, so a \0 is manually added here. Another option might be to call `zeroMem`. Passed 5 CI runs without failing.
1 parent 0435b0c commit 28422d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/std/parseutils.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,6 @@ proc parseBiggestFloat*(s: openArray[char]; number: var BiggestFloat): int {.
271271
t[ti-2] = ('0'.ord + absExponent mod 10).char
272272
absExponent = absExponent div 10
273273
t[ti-3] = ('0'.ord + absExponent mod 10).char
274+
# array not zeroed out:
275+
t[ti] = '\0'
274276
number = c_strtod(cast[cstring](addr t), nil)

0 commit comments

Comments
 (0)