Skip to content

Commit

Permalink
Fix rune decode error check in utf8 checker
Browse files Browse the repository at this point in the history
  • Loading branch information
lubux committed Jan 9, 2024
1 parent 9f86dd9 commit b3f9e83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/utf8.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (c *utf8Checker) check(p []byte) error {
continue
}
r, sizeRune := utf8.DecodeRune(p[pos:])
if r == utf8.RuneError {
if r == utf8.RuneError && sizeRune == 1 {
remaining := len(p) - pos
if remaining < maxSize {
// Could still be valid utf-8 on next check
Expand Down

0 comments on commit b3f9e83

Please sign in to comment.