geoHeil commented on issue #10921:
URL: https://github.com/apache/arrow-rs/issues/10921#issuecomment-6896618230

   The same allocate-before-read pattern is also reachable through 
`StreamReader`: `MessageReader::maybe_next` resizes the metadata buffer from an 
untrusted length and then allocates `message.bodyLength()` before either read. 
A downstream fuzz run reached this after ~2.69M executions and OOMed, so the 
issue is not limited to `read_block` (run: 
https://github.com/telekom/sutura/actions/runs/43700135555/job/132769252432).
   
   I am preparing a patch covering all three sites without imposing a 
protocol-size limit:
   - `read_block`: reject checked body+metadata lengths that exceed the 
remaining file bytes before allocating.
   - `MessageReader`: validate signed lengths and read metadata/body 
incrementally in bounded chunks, growing the destination only as bytes actually 
arrive. Truncated declarations therefore return the read error with bounded 
memory instead of forcing the declared allocation; valid large messages remain 
supported.
   
   The patch will include truncated `i32::MAX` metadata and `i64::MAX` body 
regressions plus the existing valid-message suite. I will link it here when 
available.
   


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