pedrobtz opened a new pull request, #986: URL: https://github.com/apache/arrow-nanoarrow/pull/986
`ArrowIpcEncoderEncodeFooter()` builds each `Block` of the footer on the stack with an initializer, then copies it into the flatbuffer vector. `Block` has four bytes of padding after `metaDataLength`, and an initializer doesn't set padding. So the footer carried whatever bytes were on the stack. That makes files non-reproducible, and the stack bytes end up in the file. With Apple clang 17 at `-O0`, filling the stack with `0xAB` before the call gives padding `abababab`. The vector is now zeroed after `extend`, and each element is set with the generated `Block_assign()`. Both the record batch and the dictionary block loops are changed. The new `NanoarrowIpcFooterEncodingIsDeterministic` test encodes the same footer twice, after filling the stack with `0x00` and then `0xFF`, and requires identical bytes. In a plain Debug build it fails without the fix and passes with it. Under ASan it passes either way, because ASan moves stack frames. Found through a byte-for-byte determinism test in the [zuarrow](https://github.com/pedrobtz/zuarrow) R package, which vendors nanoarrow. `ctest` passes in a plain Debug build and with ASan and UBSan (410 tests each). The changed files are formatted with the pinned clang-format 16.0.6. 🤖 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]
