diff options
author | Steve Sakoman <steve@sakoman.com> | 2022-02-07 05:20:24 -1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-23 23:43:42 +0000 |
commit | 08ecf46de00398ee1600e5fbdfd9c05e743ea176 (patch) | |
tree | 9329544127aea5333e5e0e6c09233294b8befc07 /meta/recipes-core/expat | |
parent | 68361809978f58933434b306212edb3d3a8b3165 (diff) | |
download | poky-08ecf46de00398ee1600e5fbdfd9c05e743ea176.tar.gz |
expat: fix CVE-2022-23990
Expat (aka libexpat) before 2.4.4 has an integer overflow in the
doProlog function.
Backport patch from:
https://github.com/libexpat/libexpat/pull/551/commits/ede41d1e186ed2aba88a06e84cac839b770af3a1
CVE: CVE-2021-23990
(From OE-Core rev: 6a0c9607656970c669ff12cdafd39f4fb7082f6c)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/expat')
-rw-r--r-- | meta/recipes-core/expat/expat/CVE-2022-23990.patch | 49 | ||||
-rw-r--r-- | meta/recipes-core/expat/expat_2.2.9.bb | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-core/expat/expat/CVE-2022-23990.patch b/meta/recipes-core/expat/expat/CVE-2022-23990.patch new file mode 100644 index 0000000000..c599517b3e --- /dev/null +++ b/meta/recipes-core/expat/expat/CVE-2022-23990.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From ede41d1e186ed2aba88a06e84cac839b770af3a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sebastian Pipping <sebastian@pipping.org> | ||
3 | Date: Wed, 26 Jan 2022 02:36:43 +0100 | ||
4 | Subject: [PATCH] lib: Prevent integer overflow in doProlog (CVE-2022-23990) | ||
5 | |||
6 | The change from "int nameLen" to "size_t nameLen" | ||
7 | addresses the overflow on "nameLen++" in code | ||
8 | "for (; name[nameLen++];)" right above the second | ||
9 | change in the patch. | ||
10 | |||
11 | Upstream-Status: Backport: | ||
12 | https://github.com/libexpat/libexpat/pull/551/commits/ede41d1e186ed2aba88a06e84cac839b770af3a1 | ||
13 | |||
14 | CVE: CVE-2022-23990 | ||
15 | |||
16 | Signed-off-by: Steve Sakoman <steve@sakoman.com> | ||
17 | |||
18 | --- | ||
19 | lib/xmlparse.c | 10 ++++++++-- | ||
20 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/lib/xmlparse.c b/expat/lib/xmlparse.c | ||
23 | index 5ce31402..d1d17005 100644 | ||
24 | --- a/lib/xmlparse.c | ||
25 | +++ b/lib/xmlparse.c | ||
26 | @@ -5372,7 +5372,7 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, | ||
27 | if (dtd->in_eldecl) { | ||
28 | ELEMENT_TYPE *el; | ||
29 | const XML_Char *name; | ||
30 | - int nameLen; | ||
31 | + size_t nameLen; | ||
32 | const char *nxt | ||
33 | = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar); | ||
34 | int myindex = nextScaffoldPart(parser); | ||
35 | @@ -5388,7 +5388,13 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, | ||
36 | nameLen = 0; | ||
37 | for (; name[nameLen++];) | ||
38 | ; | ||
39 | - dtd->contentStringLen += nameLen; | ||
40 | + | ||
41 | + /* Detect and prevent integer overflow */ | ||
42 | + if (nameLen > UINT_MAX - dtd->contentStringLen) { | ||
43 | + return XML_ERROR_NO_MEMORY; | ||
44 | + } | ||
45 | + | ||
46 | + dtd->contentStringLen += (unsigned)nameLen; | ||
47 | if (parser->m_elementDeclHandler) | ||
48 | handleDefault = XML_FALSE; | ||
49 | } | ||
diff --git a/meta/recipes-core/expat/expat_2.2.9.bb b/meta/recipes-core/expat/expat_2.2.9.bb index 6a6d5c066f..4c86f90ef1 100644 --- a/meta/recipes-core/expat/expat_2.2.9.bb +++ b/meta/recipes-core/expat/expat_2.2.9.bb | |||
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/libexpat/libexpat.git;protocol=https;branch=master \ | |||
12 | file://CVE-2021-46143.patch \ | 12 | file://CVE-2021-46143.patch \ |
13 | file://CVE-2022-22822-27.patch \ | 13 | file://CVE-2022-22822-27.patch \ |
14 | file://CVE-2022-23852.patch \ | 14 | file://CVE-2022-23852.patch \ |
15 | file://CVE-2022-23990.patch \ | ||
15 | file://libtool-tag.patch \ | 16 | file://libtool-tag.patch \ |
16 | " | 17 | " |
17 | 18 | ||