unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 68cf7b9ea95d1e8deda4a51a82bded4d9d7ab454 2458 bytes (raw)
name: gnu/packages/patches/openjpeg-CVE-2016-7163.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 
Fix CVE-2016-7613 (Integer overflow in opj_pi_create_decode allowing execution
of arbitrary code):

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-7163
https://github.com/uclouvain/openjpeg/issues/826
http://seclists.org/oss-sec/2016/q3/442

Copied from upstream repository:

https://github.com/uclouvain/openjpeg/commit/c16bc057ba3f125051c9966cf1f5b68a05681de4
https://github.com/uclouvain/openjpeg/commit/ef01f18dfc6780b776d0674ed3e7415c6ef54d24

From ef01f18dfc6780b776d0674ed3e7415c6ef54d24 Mon Sep 17 00:00:00 2001
From: Matthieu Darbois <mayeut@users.noreply.github.com>
Date: Thu, 8 Sep 2016 07:34:46 +0200
Subject: [PATCH] Cast to size_t before multiplication

Prevent an integer overflow issue in function opj_pi_create_decode of
pi.c.
---
 src/lib/openjp2/pi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c
index cffad66..36e2ff0 100644
--- a/src/lib/openjp2/pi.c
+++ b/src/lib/openjp2/pi.c
@@ -1237,7 +1237,13 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
 	l_current_pi = l_pi;
 
 	/* memory allocation for include */
-	l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
+	/* prevent an integer overflow issue */
+	l_current_pi->include = 00;
+	if (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))
+	{
+		l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
+	}
+
 	if
 		(!l_current_pi->include)
 	{
-- 
2.10.0

Need to cast to size_t before multiplication otherwise overflow check is useless.
---
 src/lib/openjp2/pi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c
index 36e2ff0..809b33d 100644
--- a/src/lib/openjp2/pi.c
+++ b/src/lib/openjp2/pi.c
@@ -1241,7 +1241,7 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
 	l_current_pi->include = 00;
 	if (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))
 	{
-		l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
+		l_current_pi->include = (OPJ_INT16*) opj_calloc((size_t)(l_tcp->numlayers + 1U) * l_step_l, sizeof(OPJ_INT16));
 	}
 
 	if
-- 
2.10.0

From c16bc057ba3f125051c9966cf1f5b68a05681de4 Mon Sep 17 00:00:00 2001
From: trylab <trylab@users.noreply.github.com>
Date: Tue, 6 Sep 2016 13:55:49 +0800
Subject: [PATCH] Fix an integer overflow issue (#809)


debug log:

solving 68cf7b9 ...
found 68cf7b9 in https://yhetil.org/guix-devel/27adc51d1fc250e1900d84d32f7e73d6bf67e04a.1473400918.git.leo@famulari.name/

applying [1/1] https://yhetil.org/guix-devel/27adc51d1fc250e1900d84d32f7e73d6bf67e04a.1473400918.git.leo@famulari.name/
diff --git a/gnu/packages/patches/openjpeg-CVE-2016-7163.patch b/gnu/packages/patches/openjpeg-CVE-2016-7163.patch
new file mode 100644
index 0000000..68cf7b9

1:35: space before tab in indent.
 	l_current_pi = l_pi;
1:36: trailing whitespace.
 
1:37: space before tab in indent.
 	/* memory allocation for include */
1:46: space before tab in indent.
 	if
1:47: space before tab in indent.
 		(!l_current_pi->include)
Checking patch gnu/packages/patches/openjpeg-CVE-2016-7163.patch...
Applied patch gnu/packages/patches/openjpeg-CVE-2016-7163.patch cleanly.
warning: squelched 10 whitespace errors
warning: 15 lines add whitespace errors.

index at:
100644 68cf7b9ea95d1e8deda4a51a82bded4d9d7ab454	gnu/packages/patches/openjpeg-CVE-2016-7163.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).