[dia] [scan-build] Undefined allocation of 0 bytes
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [scan-build] Undefined allocation of 0 bytes
- Date: Wed, 1 Jan 2014 16:31:00 +0000 (UTC)
commit 5e68ffa2cdcae7f7c4f56acc8706a1c794526468
Author: Hans Breuer <hans breuer org>
Date: Fri Oct 4 15:43:57 2013 +0200
[scan-build] Undefined allocation of 0 bytes
Call to 'alloca' has an allocation size of 0 bytes
File: /mnt/Home/with-git/dia/objects/standard/outline.c
Line: 371
objects/standard/outline.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/objects/standard/outline.c b/objects/standard/outline.c
index 2ea597e..db42d5a 100644
--- a/objects/standard/outline.c
+++ b/objects/standard/outline.c
@@ -367,6 +367,11 @@ outline_draw(Outline *outline, DiaRenderer *renderer)
for (i=0; i < outline->path->num_data; i += outline->path->data[i].header.length) {
++total;
}
+ /* if there is nothing to draw exit early to avoid
+ * Undefined allocation of 0 bytes (CERT MEM04-C; CWE-131)
+ */
+ if (total < 2)
+ return;
pts = g_alloca (sizeof(BezPoint)*(total));
for (i=0; i < outline->path->num_data; i += outline->path->data[i].header.length) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]