summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch')
-rw-r--r--meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch b/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch
new file mode 100644
index 0000000000..63d49481a3
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch
@@ -0,0 +1,71 @@
1Upstream-status: Backport
2http://git.busybox.net/busybox/commit/?h=1_22_stable&id=5698ff93233b47218a677fd7facd8cc90211d1a4
3
4From 5698ff93233b47218a677fd7facd8cc90211d1a4 Mon Sep 17 00:00:00 2001
5From: Denys Vlasenko <vda.linux@googlemail.com>
6Date: Mon, 30 Jun 2014 10:14:34 +0200
7Subject: [PATCH] lzop: add overflow check
8
9See CVE-2014-4607
10http://www.openwall.com/lists/oss-security/2014/06/26/20
11
12function old new delta
13lzo1x_decompress_safe 1010 1031 +21
14
15Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
16Signed-off-by: Mike Frysinger <vapier@gentoo.org>
17(cherry picked from commit a9dc7c2f59dc5e92870d2d46316ea5c1f14740e3)
18---
19 archival/libarchive/liblzo.h | 2 ++
20 archival/libarchive/lzo1x_d.c | 3 +++
21 2 files changed, 5 insertions(+)
22
23diff --git a/archival/libarchive/liblzo.h b/archival/libarchive/liblzo.h
24index 843997c..4596620 100644
25--- a/archival/libarchive/liblzo.h
26+++ b/archival/libarchive/liblzo.h
27@@ -76,11 +76,13 @@
28 # define TEST_IP (ip < ip_end)
29 # define NEED_IP(x) \
30 if ((unsigned)(ip_end - ip) < (unsigned)(x)) goto input_overrun
31+# define TEST_IV(x) if ((x) > (unsigned)0 - (511)) goto input_overrun
32
33 # undef TEST_OP /* don't need both of the tests here */
34 # define TEST_OP 1
35 # define NEED_OP(x) \
36 if ((unsigned)(op_end - op) < (unsigned)(x)) goto output_overrun
37+# define TEST_OV(x) if ((x) > (unsigned)0 - (511)) goto output_overrun
38
39 #define HAVE_ANY_OP 1
40
41diff --git a/archival/libarchive/lzo1x_d.c b/archival/libarchive/lzo1x_d.c
42index 9bc1270..40b167e 100644
43--- a/archival/libarchive/lzo1x_d.c
44+++ b/archival/libarchive/lzo1x_d.c
45@@ -92,6 +92,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
46 ip++;
47 NEED_IP(1);
48 }
49+ TEST_IV(t);
50 t += 15 + *ip++;
51 }
52 /* copy literals */
53@@ -224,6 +225,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
54 ip++;
55 NEED_IP(1);
56 }
57+ TEST_IV(t);
58 t += 31 + *ip++;
59 }
60 #if defined(COPY_DICT)
61@@ -265,6 +267,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
62 ip++;
63 NEED_IP(1);
64 }
65+ TEST_IV(t);
66 t += 7 + *ip++;
67 }
68 #if defined(COPY_DICT)
69--
701.9.1
71