viirya commented on code in PR #8097:
URL: https://github.com/apache/arrow-rs/pull/8097#discussion_r2263641468


##########
arrow-ipc/src/reader.rs:
##########
@@ -1402,7 +1402,12 @@ impl<R: Read> StreamReader<R> {
             i32::from_le_bytes(meta_size)
         };
 
-        let mut meta_buffer = vec![0; meta_len as usize];
+        let Ok(meta_len) = usize::try_from(meta_len) else {
+            return Err(ArrowError::ParseError(format!(
+                "Invalid metadata length: {meta_len}"
+            )));
+        };

Review Comment:
   ```suggestion
           let meta_len = usize::try_from(meta_len)
               .map_err(|_| ArrowError::ParseError(format!("Invalid metadata 
length: {meta_len}")))?;
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to