public inbox for pbs-devel@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

* [pbs-devel] applied: [PATCH perlmod] array: avoid underflow when array is empty and more is zero
  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 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2021-03-09 14:35 UTC (permalink / raw)
  To: Fabian Ebner; +Cc: pbs-devel

applied, but note that I re-formatted this (if-body in a new line,
semicolon inside instead of outside).

On Thu, Feb 18, 2021 at 01:47:43PM +0100, Fabian Ebner wrote:
> 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal