Skip to content

Return errors for corrupt patch chunk offsets instead of panicking - #11687

Merged
robert3005 merged 1 commit into
vortex-data:developfrom
vishalkotak:vishalkotak/patch-chunk-offsets-checked
Nov 20, 2026
Merged

robert3005 merged 1 commit into
vortex-data:developfrom
vishalkotak:vishalkotak/patch-chunk-offsets-checked

Conversation

@vishalkotak

Copy link
Copy Markdown
Contributor

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, take and slice panicked 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_chunked stays within noise (geomean 0.96 across its cases).

Could a maintainer add the changelog/fix label? I can't set labels from a fork.

I used Claude Code for analysis, debugging, and ideas.

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>
@robert3005 robert3005 added the changelog/fix A bug fix label Nov 20, 2026
@vishalkotak
vishalkotak marked this pull request as ready for review November 20, 2026 16:40
@vishalkotak

Copy link
Copy Markdown
Contributor Author

Thanks @robert3005 for the approval. Appreciate it.

@robert3005
robert3005 enabled auto-merge (squash) November 20, 2026 17:24
@codspeed

codspeed Bot commented Nov 20, 2026

Copy link
Copy Markdown

Merging this PR will regress 5 benchmarks

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 17 improved benchmarks
❌ 5 regressed benchmarks
✅ 1960 untouched benchmarks
⏩ 57 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation take_map[(0.1, 1.0)] 210.6 µs 277.2 µs -24.02%
❌ CPU Simulation take_map[(0.1, 0.5)] 137.6 µs 169.9 µs -18.97%
❌ CPU Simulation take_piecewise[256] 174.4 µs 212.9 µs -18.09%
❌ CPU Simulation take_piecewise[16] 150.3 µs 173.5 µs -13.37%
❌ Walltime threshold_avx512[80] 2.2 µs 2.5 µs -12.35%
⚡ Walltime compare_u8_neon 2.2 µs 1.6 µs +34.53%
⚡ Walltime infallible_bool_neon[i32, PerRowPerRow] 4.1 µs 3.4 µs +17.64%
⚡ Walltime compare_u64_neon 4.5 µs 3.8 µs +17.43%
⚡ Walltime scalar_subtract_neon 13.9 µs 11.9 µs +17.24%
⚡ Walltime compare_int_eq_neon 4.5 µs 3.8 µs +17.02%
⚡ Walltime compare_int_constant_neon 3.8 µs 3.2 µs +16.8%
⚡ Walltime deferred_bool_constant_neon[ConstantPerRow] 4.8 µs 4.2 µs +16.13%
⚡ Walltime infallible_bool_neon[i64, PerRowPerRow] 5.9 µs 5.2 µs +14.22%
⚡ Walltime infallible_bool_constant_neon[PerRowConstant] 4.5 µs 4 µs +13.82%
⚡ Walltime infallible_bool_constant_neon[ConstantPerRow] 4.6 µs 4.1 µs +12.67%
⚡ Walltime compare_int_neon 4.3 µs 3.8 µs +12.38%
⚡ Walltime compare_int_nullable_neon 4.7 µs 4.2 µs +11.74%
⚡ CPU Simulation density_sweep_random[0.05] 122.2 µs 109.4 µs +11.72%
⚡ Walltime deferred_bool_neon[i32, PerRowPerRow] 4.5 µs 4.1 µs +11.2%
⚡ Walltime add_constant_shapes_neon[(32768, PerRowNullableConstant)] 16.3 µs 14.7 µs +11.06%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing vishalkotak:vishalkotak/patch-chunk-offsets-checked (26f1c59) with develop (fc62bbc)

Open in CodSpeed

Footnotes

  1. 57 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@robert3005
robert3005 merged commit 7b776e8 into vortex-data:develop Nov 20, 2026
155 of 156 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants