You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Spikhalskiy (via GitHub)" <gi...@apache.org> on 2026/10/21 17:06:05 UTC
[I] [C++][FlightRPC] ipc::Message::Open reads unaligned Flatbuffers metadata in place [arrow]
Spikhalskiy opened a new issue, #54916:
URL: https://github.com/apache/arrow/issues/54916
### Describe the bug, including details regarding any error messages, version, and platform.
`ipc::Message::Open(metadata, body)` verifies and reads the Flatbuffers metadata in place. When the metadata buffer is not 8-byte aligned, every Flatbuffers access is a misaligned load (UB, reported by `-fsanitize=alignment`).
Flight hits this on every read: `DeserializeFlightData` slices `data_header` zero-copy out of the gRPC message (`ReadBytesZeroCopy`), and `FlightData::OpenMessage()` passes it straight to `Message::Open()`. `message.cc` already has `MaybeAlignMetadata()` for exactly this ("to avoid potential UBSAN issues from Flatbuffers"), but only `MessageDecoder` calls it.
Reproduction (on main, built with `-fsanitize=alignment`): copy a serialized record batch message to an odd address and call `ipc::Message::Open()` on it. UBSan reports misaligned accesses in `VerifyMessage` and `GetKeyValueMetadata`:
```
flatbuffers/buffer.h:186:20: runtime error: load of misaligned address 0x000756c38081 for type 'uoffset_t' (aka 'unsigned int'), which requires 4 byte alignment
#3 in arrow::ipc::internal::VerifyMessage(...) metadata_internal.h:190
#4 in arrow::ipc::Message::MessageImpl::Open() message.cc:90
```
Suggested fix: call `MaybeAlignMetadata(&metadata_)` at the start of `MessageImpl::Open()`. Already-aligned metadata is not copied. (Unaligned bodies are a separate matter, covered by `ensure_alignment`, #32276.)
### Component(s)
C++, FlightRPC
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org