professor-moody opened a new issue, #55368: URL: https://github.com/apache/arrow/issues/55368
### Describe the bug, including details regarding any error messages, version, and platform. The `ipc::ReadSchema(io::InputStream*, ...)` overload and `UnpackSchemaMessage` both check that the incoming message has `MessageType::SCHEMA` before decoding it. However, the `ipc::ReadSchema(const Message&, ...)` overload in `cpp/src/arrow/ipc/reader.cc` does not check `message.type()`: it passes `message.header()` directly to `internal::GetSchema`, which casts the FlatBuffer root table to `org::apache::arrow::flatbuf::Schema`. When a `RecordBatch` or `DictionaryBatch` `Message` is passed to `ipc::ReadSchema(const Message&, ...)` (including via `pyarrow.ipc.read_schema(message)`), its header table was verified only for that message type, and reading it through the `Schema` FlatBuffer accessors interprets its fields with the wrong table layout instead of returning an `Invalid` / `IOError` status. ### Expected behavior `ipc::ReadSchema(const Message&, ...)` should validate `CHECK_MESSAGE_TYPE(MessageType::SCHEMA, message.type());` before calling `internal::GetSchema`, matching the stream overload and returning the same `IOError` when given a non-`Schema` message. ### Component(s) C++, Python -- 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]
