summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/aspell
diff options
context:
space:
mode:
authorLee Chee Yang <chee.yang.lee@intel.com>2021-08-04 16:21:46 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-04 20:45:41 +0100
commit7f62ab77ae8b50197ad115753a1415db72dd8851 (patch)
tree367211d9605abeccd324bf8add5ab5e1918461ef /meta/recipes-support/aspell
parent3c492c59c0af8f4fb76b9d64539a36ede4a8c5bd (diff)
downloadpoky-7f62ab77ae8b50197ad115753a1415db72dd8851.tar.gz
aspell: fix CVE-2019-25051
(From OE-Core rev: 297f8c4eb4ff209b5ea69910902d216d86dbe2bf) Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/aspell')
-rw-r--r--meta/recipes-support/aspell/aspell_0.60.8.bb4
-rw-r--r--meta/recipes-support/aspell/files/CVE-2019-25051.patch101
2 files changed, 104 insertions, 1 deletions
diff --git a/meta/recipes-support/aspell/aspell_0.60.8.bb b/meta/recipes-support/aspell/aspell_0.60.8.bb
index 2fe8f66908..3c2b3d1666 100644
--- a/meta/recipes-support/aspell/aspell_0.60.8.bb
+++ b/meta/recipes-support/aspell/aspell_0.60.8.bb
@@ -13,7 +13,9 @@ HOMEPAGE = "http://aspell.net/"
13LICENSE = "LGPLv2 | LGPLv2.1" 13LICENSE = "LGPLv2 | LGPLv2.1"
14LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" 14LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34"
15 15
16SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz" 16SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz \
17 file://CVE-2019-25051.patch \
18"
17SRC_URI[md5sum] = "012fa9209203ae4e5a61c2a668fd10e3" 19SRC_URI[md5sum] = "012fa9209203ae4e5a61c2a668fd10e3"
18SRC_URI[sha256sum] = "f9b77e515334a751b2e60daab5db23499e26c9209f5e7b7443b05235ad0226f2" 20SRC_URI[sha256sum] = "f9b77e515334a751b2e60daab5db23499e26c9209f5e7b7443b05235ad0226f2"
19 21
diff --git a/meta/recipes-support/aspell/files/CVE-2019-25051.patch b/meta/recipes-support/aspell/files/CVE-2019-25051.patch
new file mode 100644
index 0000000000..8513f6de79
--- /dev/null
+++ b/meta/recipes-support/aspell/files/CVE-2019-25051.patch
@@ -0,0 +1,101 @@
1From 0718b375425aad8e54e1150313b862e4c6fd324a Mon Sep 17 00:00:00 2001
2From: Kevin Atkinson <kevina@gnu.org>
3Date: Sat, 21 Dec 2019 20:32:47 +0000
4Subject: [PATCH] objstack: assert that the alloc size will fit within a chunk
5 to prevent a buffer overflow
6
7Bug found using OSS-Fuze.
8
9Upstream-Status: Backport
10[https://github.com/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a]
11CVE: CVE-2019-25051
12Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
13---
14 common/objstack.hpp | 18 ++++++++++++++----
15 1 file changed, 14 insertions(+), 4 deletions(-)
16
17diff --git a/common/objstack.hpp b/common/objstack.hpp
18index 3997bf7..bd97ccd 100644
19--- a/common/objstack.hpp
20+++ b/common/objstack.hpp
21@@ -5,6 +5,7 @@
22 #include "parm_string.hpp"
23 #include <stdlib.h>
24 #include <assert.h>
25+#include <stddef.h>
26
27 namespace acommon {
28
29@@ -26,6 +27,12 @@ class ObjStack
30 byte * temp_end;
31 void setup_chunk();
32 void new_chunk();
33+ bool will_overflow(size_t sz) const {
34+ return offsetof(Node,data) + sz > chunk_size;
35+ }
36+ void check_size(size_t sz) {
37+ assert(!will_overflow(sz));
38+ }
39
40 ObjStack(const ObjStack &);
41 void operator=(const ObjStack &);
42@@ -56,7 +63,7 @@ class ObjStack
43 void * alloc_bottom(size_t size) {
44 byte * tmp = bottom;
45 bottom += size;
46- if (bottom > top) {new_chunk(); tmp = bottom; bottom += size;}
47+ if (bottom > top) {check_size(size); new_chunk(); tmp = bottom; bottom += size;}
48 return tmp;
49 }
50 // This alloc_bottom will insure that the object is aligned based on the
51@@ -66,7 +73,7 @@ class ObjStack
52 align_bottom(align);
53 byte * tmp = bottom;
54 bottom += size;
55- if (bottom > top) {new_chunk(); goto loop;}
56+ if (bottom > top) {check_size(size); new_chunk(); goto loop;}
57 return tmp;
58 }
59 char * dup_bottom(ParmString str) {
60@@ -79,7 +86,7 @@ class ObjStack
61 // always be aligned as such.
62 void * alloc_top(size_t size) {
63 top -= size;
64- if (top < bottom) {new_chunk(); top -= size;}
65+ if (top < bottom) {check_size(size); new_chunk(); top -= size;}
66 return top;
67 }
68 // This alloc_top will insure that the object is aligned based on
69@@ -88,7 +95,7 @@ class ObjStack
70 {loop:
71 top -= size;
72 align_top(align);
73- if (top < bottom) {new_chunk(); goto loop;}
74+ if (top < bottom) {check_size(size); new_chunk(); goto loop;}
75 return top;
76 }
77 char * dup_top(ParmString str) {
78@@ -117,6 +124,7 @@ class ObjStack
79 void * alloc_temp(size_t size) {
80 temp_end = bottom + size;
81 if (temp_end > top) {
82+ check_size(size);
83 new_chunk();
84 temp_end = bottom + size;
85 }
86@@ -131,6 +139,7 @@ class ObjStack
87 } else {
88 size_t s = temp_end - bottom;
89 byte * p = bottom;
90+ check_size(size);
91 new_chunk();
92 memcpy(bottom, p, s);
93 temp_end = bottom + size;
94@@ -150,6 +159,7 @@ class ObjStack
95 } else {
96 size_t s = temp_end - bottom;
97 byte * p = bottom;
98+ check_size(size);
99 new_chunk();
100 memcpy(bottom, p, s);
101 temp_end = bottom + size;