diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-03-05 19:45:59 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-03-05 19:46:13 +0100 |
commit | 5c8332d8715107e9735ef87cd95f2b4d1f95f4e7 (patch) | |
tree | c37ca3b49c74242e89a537014cd982d8db14ea38 /lib | |
parent | 1b760dcd66532c6f6ce1c048a9babffa4ba7f6b0 (diff) | |
download | Nim-5c8332d8715107e9735ef87cd95f2b4d1f95f4e7.tar.gz |
fixes #7293
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strutils.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 2ad006001..749a2696d 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -2295,7 +2295,7 @@ proc addf*(s: var string, formatstr: string, a: varargs[string, `$`]) {. case formatstr[i+1] # again we use the fact that strings # are zero-terminated here of '#': - if num >% a.high: invalidFormatString() + if num > a.high: invalidFormatString() add s, a[num] inc i, 2 inc num @@ -2311,7 +2311,7 @@ proc addf*(s: var string, formatstr: string, a: varargs[string, `$`]) {. j = j * 10 + ord(formatstr[i]) - ord('0') inc(i) let idx = if not negative: j-1 else: a.len-j - if idx >% a.high: invalidFormatString() + if idx < 0 or idx > a.high: invalidFormatString() add s, a[idx] of '{': var j = i+2 @@ -2328,7 +2328,7 @@ proc addf*(s: var string, formatstr: string, a: varargs[string, `$`]) {. inc(j) if isNumber == 1: let idx = if not negative: k-1 else: a.len-k - if idx >% a.high: invalidFormatString() + if idx < 0 or idx > a.high: invalidFormatString() add s, a[idx] else: var x = findNormalized(substr(formatstr, i+2, j-1), a) |