jacob-ablowitz opened a new pull request, #1025:
URL: https://github.com/apache/arrow-nanoarrow/pull/1025

   Closes #1024.
   
   Applies 
[dvidelabs/flatcc@0df9c097](https://github.com/dvidelabs/flatcc/commit/0df9c097a19badc8bd22d93af8fd47bd291e5d9f)
 to the vendored `check_header()` in 
`thirdparty/flatcc/src/runtime/verifier.c`. The old guard was `uoffset_size <= 
voffset_size && k + offset_size < k`. With flatcc's default offset sizes the 
first condition is false, so the wrap check never ran.
   
   `offset_size` is a `sizeof`, so `k + offset_size` only wraps where `size_t` 
is 32 bits (i386, wasm32). There, a root offset of `0xFFFFFFFC` passes 
`check_header()`, and the verifier then reads the vtable offset from the 4 
bytes before the flatbuffer. On 64-bit platforms the sum doesn't wrap and the 
existing bounds check rejects the offset.
   
   This cherry-picks only that one line, so the next revendor will carry the 
same code. The vendored copy differs from flatcc `master` in other places, and 
flatcc has no release containing this fix yet, so I've left a full revendor out 
of this PR. Happy to do that instead if you prefer.
   
   Testing:
   - New test `NanoarrowIpcVerifyRootOffsetOverflow`. It checks the error 
message because, without the fix, this particular message is still rejected on 
32-bit, only later and for a different reason (`vtable offset out of range or 
unaligned`). On 64-bit it passes with or without the fix.
   - i386 (Debian 12, GCC, `RelWithDebInfo`): the new test fails without the 
fix and passes with it, and `nanoarrow_ipc_decoder_test` passes.
   - arm64 Linux (Ubuntu 24.04, GCC, Debug with ASan): all 432 `ctest` tests 
pass.
   
   The change, the test and this description were prepared with Claude Code. I 
reviewed them and can answer for them.
   
   🤖 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]

Reply via email to