Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions rust/arrow/src/ipc/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,22 @@ impl<R: Read> StreamReader<R> {
// determine metadata length
let mut meta_size: [u8; 4] = [0; 4];
reader.read_exact(&mut meta_size)?;
let meta_len = u32::from_le_bytes(meta_size);
let meta_len = {
let meta_len = u32::from_le_bytes(meta_size);

// If a continuation marker is encountered, skip over it and read
// the size from the next four bytes.
if meta_len == CONTINUATION_MARKER {
reader.read_exact(&mut meta_size)?;
u32::from_le_bytes(meta_size)
} else {
meta_len
}
};

let mut meta_buffer = vec![0; meta_len as usize];
reader.read_exact(&mut meta_buffer)?;

// If a continuation marker is encountered, skip over it and read
// the size from the next four bytes.
if u32::from_le_bytes(meta_size) == CONTINUATION_MARKER {
reader.read_exact(&mut meta_size)?;
}

let vecs = &meta_buffer.to_vec();
let message = ipc::get_root_as_message(vecs);
// message header is a Schema, so read it
Expand Down