Repository navigation
Return Serde errors for corrupt RLE and RunEnd metadata - #10852
robert3005 merged 2 commits into
Conversation
RLE deserialize called dtype.as_ptype(), which panics for a non-primitive file dtype. RunEnd deserialize used vortex_expect on usize::try_from for num_runs and offset, which panics on 32-bit for values above usize::MAX. Both now return errors so a corrupt file read fails instead of panicking. Partially addresses vortex-data#10756 (ALP-RD covered by vortex-data#10760). Signed-off-by: Vincent <[email protected]>
…nend-deserialize-panic vortex-data#11285 moved array serde from VTable into ArrayPlugin impls, so carry the fix over: RLE's plugin deserialize uses PType::try_from(dtype) instead of dtype.as_ptype(), RunEnd's plugin deserialize returns errors for num_runs / offset values that do not fit in usize, and the regression tests now call ArrayPlugin::deserialize with ArrayDeserialization::new. Signed-off-by: Vincent <[email protected]>
|
Merged current
Locally, (AI-assisted reply.) |
Merging this PR will improve performance by 10.36%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Summary
Corrupt or crafted metadata can make a file read panic instead of returning a Serde error. #10760 covers the ALP-RD side of that issue. This PR covers the RLE and RunEnd paths called out there:
deserializecalleddtype.as_ptype(), which panics when the file dtype is not primitive. It now usesPType::try_from(dtype)?.deserializeusedvortex_expectonusize::try_fromfornum_runsandoffset, which panics on 32-bit targets when the stored value exceedsusize::MAX. Both conversions now return a Serde error.Partially addresses #10756.
Tests
utf8) dtype and expects an error (panics on develop).num_runs/offsetaboveusize::MAX(cfg(target_pointer_width = "32")). Existing RunEnd deserialize and array tests still pass on this 64-bit host.cargo test -p vortex-fastlanes --lib rle::vtable::testscargo test -p vortex-array --lib arrays::runend::array::testsAI assistance
Developed with agentic AI assistance; I reviewed the diff, ran the tests above, and stand behind the change.