File: 0001-Add-malloc-size-check.patch

package info (click to toggle)
libsixel 1.8.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,632 kB
  • sloc: ansic: 23,497; sh: 8,443; cpp: 1,227; python: 526; makefile: 444; xml: 271; ruby: 31; perl: 26
file content (24 lines) | stat: -rw-r--r-- 615 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From: Takatsugu Nokubi <takatsugu.nokubi@robotfund.co.jp>
Date: Mon, 8 Jul 2019 13:46:11 +0900
Subject: Add malloc size check

---
 src/allocator.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/allocator.c b/src/allocator.c
index b9b2d02..bb0c009 100644
--- a/src/allocator.c
+++ b/src/allocator.c
@@ -147,6 +147,11 @@ sixel_allocator_malloc(
     assert(allocator);
     assert(allocator->fn_malloc);
 
+    if (n == 0) {
+        sixel_helper_set_additional_message(
+            "sixel_allocator_malloc: called with n == 0");
+        return NULL;
+    }
     return allocator->fn_malloc(n);
 }