Copilot commented on code in PR #50038:
URL: https://github.com/apache/arrow/pull/50038#discussion_r3345228026


##########
cpp/src/arrow/ipc/reader.cc:
##########
@@ -2336,26 +2337,40 @@ Result<std::shared_ptr<SparseIndex>> ReadSparseCSXIndex(
                                      /*allow_short_read=*/false));
 
   std::vector<int64_t> indices_shape({non_zero_length});

Review Comment:
   `non_zero_length` is read directly from the SparseTensor flatbuffer and can 
be negative in crafted input. A negative value makes `indices_minimum_bytes` 
negative, which bypasses the buffer-size guard and constructs an indices Tensor 
with an invalid (negative) shape. Reject negative `non_zero_length` before 
doing the overflow-checked size computation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to