From: Fabian Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH perlmod] array: avoid underflow when array is empty and more is zero
Date: Thu, 18 Feb 2021 13:47:43 +0100 [thread overview]
Message-ID: <20210218124743.6974-1-f.ebner@proxmox.com> (raw)
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
next reply other threads:[~2021-02-18 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 12:47 Fabian Ebner [this message]
2021-03-09 14:35 ` [pbs-devel] applied: " Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210218124743.6974-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox