Awesome06 opened a new issue, #55669:
URL: https://github.com/apache/arrow/issues/55669

   ### Describe the enhancement requested
   
   ### Describe the enhancement requested
   
   In `cpp/src/arrow/ipc`, a few areas in streaming decoding and decompression 
can be made safer against invalid input buffers:
   
   1. `MessageDecoderImpl::ConsumeDataChunks` in `message.cc` uses raw pointer 
offsets (`static_cast<uint8_t*>(out) + offset`) and manual `memcpy` increments 
across chunk buffers. We can replace this with `arrow::util::span` and check 
available chunk bytes before copying.
   2. `DecompressBuffer` in `reader.cc` does not reject negative uncompressed 
sizes (`uncompressed_size < -1`) or cases where `compressed_size == 0 && 
uncompressed_size > 0`. We can also add an opt-in decompression ratio limit via 
`IpcReadOptions` (using `MultiplyWithOverflow`) for services reading untrusted 
streams.
   3. Untrusted FlatBuffers tables call `std::vector::reserve` (e.g. in 
`metadata_internal.cc`) without checking if the declared count fits within the 
remaining buffer bytes.
   4. Pass `IpcReadOptions` into `MessageDecoder` so streaming decoders can 
configure these limits.
   
   ### Component(s)
   
   C++


-- 
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