You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "rambleraptor (via GitHub)" <gi...@apache.org> on 2025/11/20 00:23:39 UTC

[PR] Add bit width check [arrow-rs]

rambleraptor opened a new pull request, #8888:
URL: https://github.com/apache/arrow-rs/pull/8888

   # fix: Prevent panic in DeltaBitPackDecoder with zero mini_blocks_per_block
   
   This change introduces a check to prevent a division-by-zero panic in `DeltaBitPackDecoder` if `mini_blocks_per_block` is zero. This can happen with malformed data. A test case is added to ensure the error is handled gracefully.
   


-- 
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-unsubscribe@arrow.apache.org

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


Re: [PR] Add bit width check [arrow-rs]

Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #8888:
URL: https://github.com/apache/arrow-rs/pull/8888#issuecomment-3558674083

   Thanks @rambleraptor. I'll merge this once 57.1.0 is tagged.


-- 
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-unsubscribe@arrow.apache.org

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


Re: [PR] Add bit width check [arrow-rs]

Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on code in PR #8888:
URL: https://github.com/apache/arrow-rs/pull/8888#discussion_r2543984700


##########
parquet/src/encodings/decoding.rs:
##########
@@ -1688,6 +1692,21 @@ mod tests {
         test_delta_bit_packed_decode::<Int64Type>(data);
     }
 
+    #[test]
+    fn test_delta_bit_packed_zero_miniblocks() {
+        // It is invalid for mini_blocks_per_block to be 0
+        let data = vec![
+            128, 1, // block_size = 128
+            0,     // mini_blocks_per_block = 0
+        ];
+        let mut decoder = DeltaBitPackDecoder::<Int32Type>::new();
+        let err = decoder.set_data(data.into(), 0).unwrap_err();
+        assert_eq!(
+            err.to_string(),
+            "Parquet error: cannot have zero miniblock per block"

Review Comment:
   ```suggestion
               "Parquet error: cannot have zero miniblocks per block"
   ```



##########
parquet/src/encodings/decoding.rs:
##########
@@ -681,6 +681,10 @@ where
             .try_into()
             .map_err(|_| general_err!("invalid 'mini_blocks_per_block'"))?;
 
+        if self.mini_blocks_per_block == 0 {
+            return Err(general_err!("cannot have zero miniblock per block"));

Review Comment:
   ```suggestion
               return Err(general_err!("cannot have zero miniblocks per block"));
   ```



-- 
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-unsubscribe@arrow.apache.org

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


Re: [PR] Add bit width check [arrow-rs]

Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl merged PR #8888:
URL: https://github.com/apache/arrow-rs/pull/8888


-- 
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-unsubscribe@arrow.apache.org

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