etseidl commented on code in PR #9884:
URL: https://github.com/apache/arrow-rs/pull/9884#discussion_r3189441765


##########
parquet/src/schema/types.rs:
##########
@@ -2517,4 +2517,22 @@ mod tests {
         let result_schema = parquet_schema_from_array(thrift_schema).unwrap();
         assert_eq!(result_schema, expected_schema);
     }
+
+    #[test]
+    fn test_parquet_schema_from_array_rejects_negative_num_children() {
+        let elements = vec![SchemaElement {
+            r#type: None,
+            type_length: None,
+            repetition_type: Some(Repetition::REQUIRED),
+            name: "schema",
+            num_children: Some(-1),
+            converted_type: None,
+            scale: None,
+            precision: None,
+            field_id: None,
+            logical_type: None,
+        }];
+        let result = parquet_schema_from_array(elements);
+        assert!(result.is_err(), "expected error, got {result:?}");

Review Comment:
   I verified this panics without the fix. 
   
   Not necessary for this PR, but for future fuzzing/validation tests, it's 
probably a good idea to verify a specific error is returned to ensure the test 
is still covering what it's supposed to.
   ```suggestion
           assert!(result.unwrap_err().to_string().contains("Integer 
overflow"));
   ```



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