fix: guarantee progress in find_all_ranges when pattern is shorter than a utf8 sequence

This commit is contained in:
CJ van den Berg 2025-11-26 10:22:04 +01:00
parent 99f9f95dbc
commit 74e7406034
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 6 additions and 2 deletions

View file

@ -212,7 +212,7 @@ const Utf8PartialIterator = struct {
return null;
}
const cp_len = utf8ByteSequenceLength(it.bytes[it.end]) catch unreachable;
const cp_len = utf8ByteSequenceLength(it.bytes[it.end]) catch return null;
if (it.end + cp_len > it.bytes.len) {
return null;
}