alamb commented on code in PR #8097: URL: https://github.com/apache/arrow-rs/pull/8097#discussion_r2263514338
########## arrow-ipc/src/reader.rs: ########## @@ -1402,6 +1402,12 @@ impl<R: Read> StreamReader<R> { i32::from_le_bytes(meta_size) }; + if meta_len < 0 { Review Comment: Instead of checking explictly for `< 0` I suggest we try to do the conversion to `usize` here rather than belpw So instead of ```rust let mut meta_buffer = vec![0; meta_len as usize]; ``` Something like ```rust let Ok(meta_len) = usize::try_from(meta_len) else { return Err(ArrowError::ParseError(format!( "Invalid metadata length: {meta_len}" ))); } let mut meta_buffer = vec![0; meta_len]; ``` Both here and below -- 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