Repository navigation
Return errors for corrupt patch chunk offsets instead of panicking - #11687
robert3005 merged 1 commit into
Conversation
Patch chunk offsets are read from files, so they are untrusted. Offsets where a later chunk is below the first, or too few offsets for the array, made search_index, get_patched, take and slice panic in debug builds and compute wrapped indices in release builds. These lookups now return an error instead. Signed-off-by: Vishal Kotak <22182951+vishalkotak@users.noreply.github.com>
|
Thanks @robert3005 for the approval. Appreciate it. |
Merging this PR will regress 5 benchmarks1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Patch chunk offsets come straight from the file, so a reader can't trust them. With corrupt offsets, for example a later chunk whose offset is below the first, or fewer offsets than the array has chunks,
search_index,get_patched,takeandslicepanicked on an underflow or an out-of-bounds index in debug builds, and computed wrapped indices in release builds. This returns an error instead, the same way #10756 handled other corrupt metadata.I ran into it while reviewing #11644. Now that ALP-RD stores chunk offsets too, its files go through the same paths. Valid offsets behave exactly as before, and
take_search_chunkedstays within noise (geomean 0.96 across its cases).Could a maintainer add the
changelog/fixlabel? I can't set labels from a fork.I used Claude Code for analysis, debugging, and ideas.