summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2012-12-28 00:28:51 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-03 12:34:26 (GMT)
commit151d4fbc4e10aea97515757d3f2ff70f86ea9148 (patch)
treedab0776fea94c284c7a26581db51b788322deac2
parentcaa1d0308959800ef8d4b730bfbf31fa15593e62 (diff)
downloadpoky-151d4fbc4e10aea97515757d3f2ff70f86ea9148.tar.gz
cups: patch for CVE-2011-2896
Patch from: http://cups.org/strfiles/3867/str3867.patch The LZW decompressor in the LWZReadByte function in giftoppm.c in the David Koblas GIF decoder in PBMPLUS, as used in the gif_read_lzw function in filter/image-gif.c in CUPS before 1.4.7, the LZWReadByte function in plug-ins/common/file-gif-load.c in GIMP 2.6.11 and earlier, the LZWReadByte function in img/gifread.c in XPCE in SWI-Prolog 5.10.4 and earlier, and other products, does not properly handle code words that are absent from the decompression table when encountered, which allows remote attackers to trigger an infinite loop or a heap-based buffer overflow, and possibly execute arbitrary code, via a crafted compressed stream, a related issue to CVE-2006-1168 and CVE-2011-2895. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-2896 [YOCTO #3582] [ CQID: WIND00299595 ] (From OE-Core rev: f4aca76c7933abf2771999c309d49ab91a3d9480) Signed-off-by: Li Wang <li.wang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Merged with denzil branch, partial fix for denzil bug [YOCTO #3652] Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/cups/cups-1.4.6/cups-CVE-2011-2896.patch140
-rw-r--r--meta/recipes-extended/cups/cups_1.4.6.bb3
2 files changed, 142 insertions, 1 deletions
diff --git a/meta/recipes-extended/cups/cups-1.4.6/cups-CVE-2011-2896.patch b/meta/recipes-extended/cups/cups-1.4.6/cups-CVE-2011-2896.patch
new file mode 100644
index 0000000..7c6f75b
--- /dev/null
+++ b/meta/recipes-extended/cups/cups-1.4.6/cups-CVE-2011-2896.patch
@@ -0,0 +1,140 @@
1cups - CVE-2011-2896
2
3the patch come from:
4http://cups.org/strfiles/3867/str3867.patch
5
6The LZW decompressor in the LWZReadByte function in giftoppm.c
7in the David Koblas GIF decoder in PBMPLUS, as used in the
8gif_read_lzw function in filter/image-gif.c in CUPS before 1.4.7,
9the LZWReadByte function in plug-ins/common/file-gif-load.c
10in GIMP 2.6.11 and earlier, the LZWReadByte function in img/gifread.c
11in XPCE in SWI-Prolog 5.10.4 and earlier, and other products,
12does not properly handle code words that are absent from the
13decompression table when encountered, which allows remote attackers to
14trigger an infinite loop or a heap-based buffer overflow, and possibly
15execute arbitrary code, via a crafted compressed stream, a related
16issue to CVE-2006-1168 and CVE-2011-2895.
17http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-2896
18
19Integrated-by: Li Wang <li.wang@windriver.com>
20---
21 filter/image-gif.c | 46 ++++++++++++++++++++--------------------------
22 1 files changed, 20 insertions(+), 26 deletions(-)
23
24diff --git a/filter/image-gif.c b/filter/image-gif.c
25index 3857c21..fa9691e 100644
26--- a/filter/image-gif.c
27+++ b/filter/image-gif.c
28@@ -353,7 +353,7 @@ gif_get_code(FILE *fp, /* I - File to read from */
29 * Read in another buffer...
30 */
31
32- if ((count = gif_get_block (fp, buf + last_byte)) <= 0)
33+ if ((count = gif_get_block(fp, buf + last_byte)) <= 0)
34 {
35 /*
36 * Whoops, no more data!
37@@ -582,19 +582,13 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
38 gif_get_code(fp, 0, 1);
39
40 /*
41- * Wipe the decompressor table...
42+ * Wipe the decompressor table (already mostly 0 due to the calloc above...)
43 */
44
45 fresh = 1;
46
47- for (i = 0; i < clear_code; i ++)
48- {
49- table[0][i] = 0;
50+ for (i = 1; i < clear_code; i ++)
51 table[1][i] = i;
52- }
53-
54- for (; i < 4096; i ++)
55- table[0][i] = table[1][0] = 0;
56
57 sp = stack;
58
59@@ -605,29 +599,30 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
60 fresh = 0;
61
62 do
63+ {
64 firstcode = oldcode = gif_get_code(fp, code_size, 0);
65+ }
66 while (firstcode == clear_code);
67
68- return (firstcode);
69+ return (firstcode & 255);
70 }
71 else if (!table)
72 return (0);
73
74 if (sp > stack)
75- return (*--sp);
76+ return ((*--sp) & 255);
77
78- while ((code = gif_get_code (fp, code_size, 0)) >= 0)
79+ while ((code = gif_get_code(fp, code_size, 0)) >= 0)
80 {
81 if (code == clear_code)
82 {
83- for (i = 0; i < clear_code; i ++)
84- {
85- table[0][i] = 0;
86- table[1][i] = i;
87- }
88+ /*
89+ * Clear/reset the compression table...
90+ */
91
92- for (; i < 4096; i ++)
93- table[0][i] = table[1][i] = 0;
94+ memset(table, 0, 2 * sizeof(gif_table_t));
95+ for (i = 1; i < clear_code; i ++)
96+ table[1][i] = i;
97
98 code_size = set_code_size + 1;
99 max_code_size = 2 * clear_code;
100@@ -637,12 +632,11 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
101
102 firstcode = oldcode = gif_get_code(fp, code_size, 0);
103
104- return (firstcode);
105+ return (firstcode & 255);
106 }
107- else if (code == end_code)
108+ else if (code == end_code || code > max_code)
109 {
110- unsigned char buf[260];
111-
112+ unsigned char buf[260]; /* Block buffer */
113
114 if (!gif_eof)
115 while (gif_get_block(fp, buf) > 0);
116@@ -652,7 +646,7 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
117
118 incode = code;
119
120- if (code >= max_code)
121+ if (code == max_code)
122 {
123 if (sp < (stack + 8192))
124 *sp++ = firstcode;
125@@ -690,10 +684,10 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
126 oldcode = incode;
127
128 if (sp > stack)
129- return (*--sp);
130+ return ((*--sp) & 255);
131 }
132
133- return (code);
134+ return (code & 255);
135 }
136
137
138--
1391.7.0.5
140
diff --git a/meta/recipes-extended/cups/cups_1.4.6.bb b/meta/recipes-extended/cups/cups_1.4.6.bb
index ec555d7..3e31c08 100644
--- a/meta/recipes-extended/cups/cups_1.4.6.bb
+++ b/meta/recipes-extended/cups/cups_1.4.6.bb
@@ -1,6 +1,6 @@
1require cups14.inc 1require cups14.inc
2 2
3PR = "r3" 3PR = "r4"
4DEPENDS += "libusb \ 4DEPENDS += "libusb \
5 ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" 5 ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
6 6
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=956e7600195e6139f12de8c2a5bbefa9"
8SRC_URI += " \ 8SRC_URI += " \
9 file://use_echo_only_in_init.patch \ 9 file://use_echo_only_in_init.patch \
10 file://0001-don-t-try-to-run-generated-binaries.patch \ 10 file://0001-don-t-try-to-run-generated-binaries.patch \
11 file://cups-CVE-2011-2896.patch \
11 " 12 "
12 13
13SRC_URI[md5sum] = "de8fb5a29c36554925c0c6a6e2c0dae1" 14SRC_URI[md5sum] = "de8fb5a29c36554925c0c6a6e2c0dae1"