Repository navigation
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
binary_sliceusesINT64_MAXas its default stop. The output-size estimate used that value directly, which could overflow for multiple input values and cause valid calls such asbinary_slice(values, 1)to fail withArrowInvalid: Negative buffer resize.Closes #51222.
What changes are included in this PR?
Clamp the stop value to the available input byte range before calculating the maximum output size, matching the existing
utf8_slice_codeunitsimplementation. Add regression coverage for both binary and large-binary arrays.Are these changes tested?
Yes.
*SliceBytes*C++ tests: 10 passed.arrow-compute-scalar-type-test: 348 passed, with one pre-existing disabled test.git diff --checkpassed.Are there any user-facing changes?
Yes. Calling
binary_slicewith its default stop on sufficiently long input now returns the expected slice instead of raisingArrowInvalid: Negative buffer resize.Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
OpenAI Codex assisted with investigation, implementation, test selection, validation, and drafting this description. I reviewed the change, understand it, and take responsibility for the contribution.
PR code and description written by:
Reviewed before submission by:
stopraises "Negative buffer resize" #51222