gty404 opened a new pull request, #1043:
URL: https://github.com/apache/iceberg-cpp/pull/1043
## Summary
- `ProjectBatchNanoarrow` validated incoming batches at
`NANOARROW_VALIDATION_LEVEL_DEFAULT` before using
`ArrowArrayViewGet{String,Bytes}Unsafe` and raw list/map offset arithmetic per
row. nanoarrow documents these `Unsafe` accessors as memory-safe only after
`FULL` validation: `DEFAULT` only checks the first/last offsets, not that every
intermediate offset is non-decreasing and in-bounds.
- A non-monotonic intermediate offset can produce a negative size that
overflows to a huge `size_t` in the append path, or an out-of-range offset
whose bytes get copied into the returned output batch.
- Raise the validation level to `NANOARROW_VALIDATION_LEVEL_FULL`, matching
what `manifest_reader.cc` already does for the same untrusted-batch boundary,
closing the inconsistency between the two call sites.
## Test plan
- Added `ProjectBatchTest.RejectsNonMonotonicStringOffsets`, which
hand-assembles (via the nanoarrow C ABI, since Arrow's builders always emit
monotonic offsets) a string array with offsets `[0, 5, 2]`: the first/last
offsets are consistent with the 2-byte data buffer, so `DEFAULT` validation
accepts it, but `FULL` validation correctly rejects it as non-monotonic.
- Verified the new test fails without the fix (stashed the one-line change,
rebuilt, confirmed `ProjectBatch` returned a value instead of an error) and
passes with it.
- `./src/iceberg/test/data_test` — 103/103 passed.
- `pre-commit run` on the changed files — passed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]