etseidl commented on PR #12340:
URL: https://github.com/apache/arrow-rs/pull/12340#issuecomment-7021287518
Thanks @Rich-T-kid. Here's my 100% AI generated review 😄 Take with a
`<fill-in-the-unit>` of salt.
### P2 — Capacity checks still allow allocation-layout panics
The new checks validate usize arithmetic, but vectors also impose
byte-capacity limits.
- CSV — arrow-csv/src/reader/records.rs:86–90: With one column and
```rust
to_read = isize::MAX as usize / size_of::<usize>() + 1
```
the element-count checks succeed, then offsets.resize(...) panics with
capacity overflow. The later data-capacity guard is never reached. This is
reachable through the public batch-size setting.
- FixedSizeBinary — arrow-integration-test/src/lib.rs:711–717: With byte
width 1 and count = isize::MAX as usize + 1, the multiplication check succeeds,
but the builder’s Vec::with_capacity still panics.
I reproduced both without attempting huge allocations. These are
pre-existing gaps left uncovered, not new regressions. They belong within the
PR’s claimed capacity audit.
Suggested fix: Check vector byte/layout limits before allocation, or use
fallible reservation. For CSV, preflight both buffers before resizing either.
### Coverage gap — No regression tests for the new error paths
The explanation that tests would require maximum-size fixtures isn’t
convincing. Small cases can cover:
- Int8 128 and UInt8 256.
- An oversized Decimal256 decimal string.
- A view with overflowing offset-plus-size and a tiny buffer.
- The allocation-free capacity cases above.
- Flight overflow using zero-column batches with explicit row counts.
Existing happy-path tests don’t exercise these guards.
--
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]