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

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


The following commit(s) were added to refs/heads/master by this push:
     new f055f51c9 Validate decimal IPC read (#2387) (#2880)
f055f51c9 is described below

commit f055f51c9d80799c54b68f790cf6656ce5ad090a
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Sun Oct 16 08:54:14 2022 +1300

    Validate decimal IPC read (#2387) (#2880)
---
 arrow/src/ipc/reader.rs | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arrow/src/ipc/reader.rs b/arrow/src/ipc/reader.rs
index a784f54e2..63c587455 100644
--- a/arrow/src/ipc/reader.rs
+++ b/arrow/src/ipc/reader.rs
@@ -486,16 +486,12 @@ fn create_primitive_array(
             .unwrap(),
         Decimal128(_, _) | Decimal256(_, _) => {
             // read 2 buffers: null buffer (optional) and data buffer
-            let builder = ArrayData::builder(data_type.clone())
+            ArrayData::builder(data_type.clone())
                 .len(length)
                 .add_buffer(buffers[1].clone())
-                .null_bit_buffer(null_buffer);
-
-            // Don't validate the decimal array so far,
-            // becasue validating decimal is some what complicated
-            // and there is no conclusion on whether we should do it.
-            // For more infomation, please look at 
https://github.com/apache/arrow-rs/issues/2387
-            unsafe { builder.build_unchecked() }
+                .null_bit_buffer(null_buffer)
+                .build()
+                .unwrap()
         }
         t => unreachable!("Data type {:?} either unsupported or not 
primitive", t),
     };

Reply via email to