amitcoder79 opened a new pull request, #12133: URL: https://github.com/apache/arrow-rs/pull/12133
# Which issue does this PR close? Closes #12100 # Rationale `ThriftReadInputProtocol::read_bytes_owned` reads a length from the Thrift stream and passes it directly to `Vec::with_capacity`. A malformed file can declare a multi-terabyte `binary` field, causing an OOM abort before any bytes are read. PR #10979 added similar checks for `read_thrift_vec`; this covers the `Read`-based Thrift decoder. # What changes are included in this PR? Cap the initial allocation at 8 MB. The actual read (`io::copy` + `take`) is already bounded by the stream, so an overlong declared length returns `UnexpectedEof` rather than allocating the declared amount. The Vec grows as needed for legitimate large values. # Are there any user-facing changes? Malformed Thrift files that previously caused an OOM abort now return an error. No behavior change for valid files. -- 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]
