You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ne...@apache.org on 2020/04/03 12:36:13 UTC

[arrow] branch master updated: ARROW-8225: [Rust] Continuation marker check was in wrong location.

This is an automated email from the ASF dual-hosted git repository.

nevime pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 585ce8d  ARROW-8225: [Rust] Continuation marker check was in wrong location.
585ce8d is described below

commit 585ce8d18b552cd6e70e52372da826582a891755
Author: Max Burke <ma...@urbanlogiq.com>
AuthorDate: Fri Apr 3 14:35:49 2020 +0200

    ARROW-8225: [Rust] Continuation marker check was in wrong location.
    
    In the previous commit I had the continuation marker check in the wrong location.
    
    Closes #6791 from maxburke/rust_continuation_2
    
    Authored-by: Max Burke <ma...@urbanlogiq.com>
    Signed-off-by: Neville Dipale <ne...@gmail.com>
---
 rust/arrow/src/ipc/reader.rs | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/rust/arrow/src/ipc/reader.rs b/rust/arrow/src/ipc/reader.rs
index 8035611..37fb0b8 100644
--- a/rust/arrow/src/ipc/reader.rs
+++ b/rust/arrow/src/ipc/reader.rs
@@ -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