New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-15360: [Python] Check slice bounds in Buffer.slice() #12182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Calling Buffer.slice() with invalid arguments could return a Buffer referencing out-of-bounds memory. With this change, an IndexError is raised instead. Note that Buffer.__getitem__() is unaffected, as it applies Python slice semantics: indices out of bounds are automatically clamped.
a157d2d
to
0b39245
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Antoine!
Benchmark runs are scheduled for baseline = 09f23ed and contender = fd580db. fd580db is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Calling
Buffer.slice()
with invalid arguments could return a Buffer referencing out-of-bounds memory.With this change, an IndexError is raised instead.
Note that
Buffer.__getitem__()
is unaffected, as it applies Python slice semantics: indices out of bounds are automatically clamped.