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


##########
parquet/src/encodings/decoding.rs:
##########
@@ -382,6 +382,12 @@ impl<T: DataType> Decoder<T> for DictDecoder<T> {
     fn set_data(&mut self, data: Bytes, num_values: usize) -> Result<()> {
         // First byte in `data` is bit width
         let bit_width = data.as_ref()[0];
+        if bit_width > 32 {
+            return Err(general_err!(
+                "Invalid or corrupted Bit width {}. Max allowed is 32",

Review Comment:
   ```suggestion
                   "Invalid or corrupted RLE bit width {}. Max allowed is 32",
   ```



##########
parquet/src/schema/types.rs:
##########
@@ -1359,6 +1359,8 @@ fn schema_from_array_helper<'a>(
                 if !is_root_node {
                     builder = builder.with_repetition(rep);
                 }
+            } else if !is_root_node {
+                return Err(general_err!("Repetition level must be defined for 
non-root types"));

Review Comment:
   Minor nit: I think I'd prefer this mirror the test above at L1297, but this 
works too.



##########
parquet/tests/arrow_reader/bad_data.rs:
##########
@@ -84,10 +84,12 @@ fn test_parquet_1481() {
 }
 
 #[test]
-#[should_panic(expected = "assertion failed: self.current_value.is_some()")]
 fn test_arrow_gh_41321() {
     let err = read_file("ARROW-GH-41321.parquet").unwrap_err();
-    assert_eq!(err.to_string(), "TBD (currently panics)");
+    assert_eq!(
+        err.to_string(),
+        "External: Parquet argument error: Parquet error: Invalid or corrupted 
Bit width 254. Max allowed is 32"
+    );

Review Comment:
   ❤️ 



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