You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e983649
Browse filesBrowse the repository at this point in the historyBrowse files
fix(core): reject text-arm offsets that split a character
Sixth review round — cubic and Kilo on the previous commit, both pointing at the
`{text}`-arm validation that commit had just added.
- That validation checked the range but not the character boundary, so a byte
offset landing inside a multi-byte sequence was accepted: for the line `éa`
(3 bytes) a corrupt `start: 1` splits `é`, and a consumer slicing the line's
UTF-8 encoding there gets invalid bytes. The `{bytes}` arm already rejected
exactly that shape. Both arms now apply the same continuation-byte check.
ripgrep never emits a mid-boundary offset for a valid-UTF-8 line, so this
drops nothing legitimate — a boundary-aligned offset on the same line is kept,
which the tests assert alongside the rejection.
The line is encoded once per record and shared by every submatch. That
replaces the `Buffer.byteLength` walk the previous commit added rather than
stacking on top of it; the extra cost is the allocation.
- Fixed a comment stale as of the previous commit: it still said `{text}`-arm
offsets are untouched and that no claim is made about them, which the
validation added in that same commit contradicts.
- Gave the >16 MiB record test an explicit 30s timeout. It materialises the
record, so it is slow enough to trip the default when the suite runs under
load; it failed once that way locally while another suite ran concurrently,
then passed 3/3 in isolation.
Tests: 24 core, 14 legacy.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
0 commit comments