all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH perlmod] array: avoid underflow when array is empty and more is zero
@ 2021-02-18 12:47 Fabian Ebner
  2021-03-09 14:35 ` [pbs-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2021-02-18 12:47 UTC (permalink / raw)
  To: pbs-devel

serializing an empty array triggered this.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 perlmod/src/array.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/perlmod/src/array.rs b/perlmod/src/array.rs
index ce6e112..f0bce57 100644
--- a/perlmod/src/array.rs
+++ b/perlmod/src/array.rs
@@ -102,6 +102,7 @@ impl Array {
 
     /// Pre-extend the array to up to the specified length..
     pub fn reserve(&self, more: usize) {
+        if more == 0 { return };
         let idx = self.len() + more - 1;
         unsafe {
             ffi::RSPL_av_extend(self.av(), idx as libc::ssize_t);
-- 
2.20.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-09 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 12:47 [pbs-devel] [PATCH perlmod] array: avoid underflow when array is empty and more is zero Fabian Ebner
2021-03-09 14:35 ` [pbs-devel] applied: " Wolfgang Bumiller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal