mzabaluev commented on code in PR #9397:
URL: https://github.com/apache/arrow-rs/pull/9397#discussion_r2809835871


##########
arrow-avro/src/reader/cursor.rs:
##########
@@ -130,4 +123,27 @@ impl<'a> AvroCursor<'a> {
         self.buf = &self.buf[n..];
         Ok(ret)
     }
+
+    pub(crate) fn skip_int(&mut self) -> Result<(), AvroError> {
+        let offset = vlq::skip_varint(self.buf)
+            .ok_or_else(|| AvroError::ParseError("bad varint".to_string()))?;
+        // Check if the skipped encoded value would fail a conversion to i32;
+        // skip_varint only cares about fitting in a 64-bit value.
+        match offset {
+            ..5 => {}
+            5 if self.buf[4] < 0x10 => {}
+            _ => return Err(AvroError::ParseError("varint 
overflow".to_owned())),
+        }

Review Comment:
   I thought of creating another function alongside `skip_varint` for the 
32-bit case. But the optimizer should be able to thread the branches of the 
unrolled loop in `skip_varint_array` through this.



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