tustvold commented on code in PR #3944:
URL: https://github.com/apache/arrow-rs/pull/3944#discussion_r1150308482


##########
arrow-schema/src/ffi.rs:
##########
@@ -152,6 +157,46 @@ impl FFI_ArrowSchema {
         Ok(self)
     }
 
+    pub fn with_metadata(
+        mut self,
+        metadata: Option<&HashMap<String, String>>,
+    ) -> Result<Self, ArrowError> {
+        let new_metadata = if let Some(metadata) = metadata {
+            if !metadata.is_empty() {
+                let mut metadata_serialized: Vec<u8> = Vec::new();
+                metadata_serialized.extend((metadata.len() as 
i32).to_ne_bytes());
+
+                for (key, value) in metadata.iter() {
+                    let key_len = key.len() as i32;
+                    let value_len = value.len() as i32;

Review Comment:
   The codebase is full of overflow handling, take a look at the builders or 
take kernels or Array validation.
   
   I'm keen that we are defensive here, because the implications of incorrect 
data is that we go off reading arbitrary memory



-- 
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]

Reply via email to