[pbs-devel] applied: [PATCH perlmod] array: avoid underflow when array is empty and more is zero

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Mar 9 15:35:41 CET 2021


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





More information about the pbs-devel mailing list