parser: don't overflow when parsing bad times (#593)

Fixes #585
This commit is contained in:
Thomas Pelletier
2021-09-09 11:59:37 -04:00
committed by GitHub
parent f34c9c332f
commit fa56f48daf
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -894,6 +894,11 @@ byteLoop:
case c == ' ':
if !seenSpace && i+1 < len(b) && isDigit(b[i+1]) {
i += 2
// Avoid reaching past the end of the document in case the time
// is malformed. See TestIssue585.
if i >= len(b) {
i--
}
seenSpace = true
hasTime = true
} else {