You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/05/05 18:56:39 UTC

[PR] [57_maintenance] Prevent buffer builder length overflow in MutableBuffer::extend_zeros (#9820) [arrow-rs]

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

   - Part of https://github.com/apache/arrow-rs/issues/9858
   - Fixes https://github.com/apache/arrow-rs/issues/9897 in 57.x releases
   
   This PR:
   - Backports https://github.com/apache/arrow-rs/pull/9820 from @alamb to the `57_maintenance` line
   
   Note: `MutableBuffer::extend_bool_trusted_len` is not present on the `57_maintenance` line, so this backport omits the documentation-only hunk for that API.
   


-- 
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] [57_maintenance] Prevent buffer builder length overflow in MutableBuffer::extend_zeros (#9820) [arrow-rs]

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


##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -575,13 +630,26 @@ impl MutableBuffer {
     }
 
     /// Extends the buffer by `additional` bytes equal to `0u8`, incrementing its capacity if needed.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `self.len + additional` overflows `usize`, or if growing the buffer requires
+    /// reserving a capacity that fails for the same reasons as [`MutableBuffer::reserve`].
     #[inline]
     pub fn extend_zeros(&mut self, additional: usize) {
-        self.resize(self.len + additional, 0);
+        let new_len = self
+            .len
+            .checked_add(additional)

Review Comment:
   here is the new check



-- 
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] [57_maintenance] Prevent buffer builder length overflow in MutableBuffer::extend_zeros (#9820) [arrow-rs]

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


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