summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/strutils.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index e888b11f9..a946bc8c6 100644
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -377,7 +377,7 @@ proc cmpIgnoreStyle*(a, b: string): int {.noSideEffect,
 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