fixes a critical strutils bug [backport]

(cherry picked from commit 68ce92d4eb)
This commit is contained in:
Araq
2019-02-19 19:37:16 +01:00
committed by narimiran
parent 32780acc61
commit aa2dfd1cef

View File

@@ -435,7 +435,7 @@ proc isNilOrWhitespace*(s: string): bool {.noSideEffect, procvar, rtl, extern: "
proc substrEq(s: string, pos: int, substr: string): bool =
var i = 0
var length = substr.len
while i < length and s[pos+i] == substr[i]:
while i < length and pos+i < s.len and s[pos+i] == substr[i]:
inc i
return i == length