GH-50304: [C++][IPC] Reject negative sparse tensor shape and non-zero length#50305
Merged
Conversation
|
|
2c55fa7 to
dfc80a1
Compare
pitrou
approved these changes
Jun 30, 2026
…n-zero length Validate dimension sizes and non_zero_length in GetSparseTensorMetadata so malformed IPC SparseTensor messages are rejected before the values flow into buffer-size computations. The now-redundant non-zero-length check in ReadSparseCSXIndex is removed in favour of this central guard.
7a67bf9 to
f92124f
Compare
pitrou
approved these changes
Jun 30, 2026
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 72a970f. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
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
GetSparseTensorMetadataand the sparse-tensor readers incpp/src/arrow/ipc/currently accept several sizes from an IPC SparseTensor message without validation. We Want to introduce validations.GetSparseTensorMetadataaccepts the per-dimensionTensorDim.sizeand the tensor'snon_zero_lengthfrom an IPCSparseTensormessage without validation.What changes are included in this PR?
sizeandnon_zero_lengthinGetSparseTensorMetadata.non_zero_length < 0check inReadSparseCSXIndexAre these changes tested?
Yes, see
cpp/src/arrow/ipc/tensor_test.cc.Are there any user-facing changes?
IPC messages are more scrutinized.