sliced()
function on polars-arrow
Array is unsound, allows out-of-bounds access in release mode
#20239
Open
2 tasks done
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
rust
Related to Rust Polars
Checks
Reproducible example
Log output
No response
Issue description
The code for the
sliced
function attempts to perform a bounds-check to prevent the returned array from going out-of-bounds:In debug mode, the expression
offset + length
will panic on overflow, which makes this check correct.In release mode, the expression
offset + length
will wrap, possibly producing a value that's smaller thanself.len()
even though the new slice is out-of-bounds.Expected behavior
sliced()
should also panic in release mode if given out-of-bounds arguments.Installed versions
The text was updated successfully, but these errors were encountered: