diff options
| author | Armin Kuster <akuster@mvista.com> | 2015-12-05 10:58:09 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-14 15:18:28 +0000 |
| commit | 55d097a106a93ea0b5533d4eed42ba52491f79d6 (patch) | |
| tree | 5a2f13498b1a15764d0421f7756d54258364dbe5 | |
| parent | 8e6b2d682338d3e1517b30386baa0cb3b69f2ea2 (diff) | |
| download | poky-55d097a106a93ea0b5533d4eed42ba52491f79d6.tar.gz | |
libxml2: security fix CVE-2015-7499
includes:
CVE-2015-7499-1
CVE-2015-7499-2
(From OE-Core rev: 51aedd5307b92b63d97b63bd9911eda67ee6fde8)
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
3 files changed, 133 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc index 65b262582b..3073851a53 100644 --- a/meta/recipes-core/libxml/libxml2.inc +++ b/meta/recipes-core/libxml/libxml2.inc | |||
| @@ -29,6 +29,8 @@ SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \ | |||
| 29 | file://0001-CVE-2015-8035-Fix-XZ-compression-support-loop.patch \ | 29 | file://0001-CVE-2015-8035-Fix-XZ-compression-support-loop.patch \ |
| 30 | file://CVE-2015-7498-Avoid-processing-entities-after-encoding-conversion-.patch \ | 30 | file://CVE-2015-7498-Avoid-processing-entities-after-encoding-conversion-.patch \ |
| 31 | file://0001-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch \ | 31 | file://0001-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch \ |
| 32 | file://CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch \ | ||
| 33 | file://CVE-2015-7499-2-Detect-incoherency-on-GROW.patch \ | ||
| 32 | " | 34 | " |
| 33 | 35 | ||
| 34 | BINCONFIG = "${bindir}/xml2-config" | 36 | BINCONFIG = "${bindir}/xml2-config" |
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch new file mode 100644 index 0000000000..e39ec65cd9 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | From 28cd9cb747a94483f4aea7f0968d202c20bb4cfc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Veillard <veillard@redhat.com> | ||
| 3 | Date: Fri, 20 Nov 2015 14:55:30 +0800 | ||
| 4 | Subject: [PATCH] Add xmlHaltParser() to stop the parser | ||
| 5 | |||
| 6 | The problem is doing it in a consistent and safe fashion | ||
| 7 | It's more complex than just setting ctxt->instate = XML_PARSER_EOF | ||
| 8 | Update the public function to reuse that new internal routine | ||
| 9 | |||
| 10 | Upstream-Status: Backport | ||
| 11 | |||
| 12 | CVE-2015-7499-1 | ||
| 13 | |||
| 14 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | parser.c | 34 +++++++++++++++++++++++++++++----- | ||
| 18 | 1 file changed, 29 insertions(+), 5 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/parser.c b/parser.c | ||
| 21 | index da6e729..b6e99b1 100644 | ||
| 22 | --- a/parser.c | ||
| 23 | +++ b/parser.c | ||
| 24 | @@ -94,6 +94,8 @@ static xmlParserCtxtPtr | ||
| 25 | xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, | ||
| 26 | const xmlChar *base, xmlParserCtxtPtr pctx); | ||
| 27 | |||
| 28 | +static void xmlHaltParser(xmlParserCtxtPtr ctxt); | ||
| 29 | + | ||
| 30 | /************************************************************************ | ||
| 31 | * * | ||
| 32 | * Arbitrary limits set in the parser. See XML_PARSE_HUGE * | ||
| 33 | @@ -12625,25 +12627,47 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data, | ||
| 34 | #endif /* LIBXML_PUSH_ENABLED */ | ||
| 35 | |||
| 36 | /** | ||
| 37 | - * xmlStopParser: | ||
| 38 | + * xmlHaltParser: | ||
| 39 | * @ctxt: an XML parser context | ||
| 40 | * | ||
| 41 | - * Blocks further parser processing | ||
| 42 | + * Blocks further parser processing don't override error | ||
| 43 | + * for internal use | ||
| 44 | */ | ||
| 45 | -void | ||
| 46 | -xmlStopParser(xmlParserCtxtPtr ctxt) { | ||
| 47 | +static void | ||
| 48 | +xmlHaltParser(xmlParserCtxtPtr ctxt) { | ||
| 49 | if (ctxt == NULL) | ||
| 50 | return; | ||
| 51 | ctxt->instate = XML_PARSER_EOF; | ||
| 52 | - ctxt->errNo = XML_ERR_USER_STOP; | ||
| 53 | ctxt->disableSAX = 1; | ||
| 54 | if (ctxt->input != NULL) { | ||
| 55 | + /* | ||
| 56 | + * in case there was a specific allocation deallocate before | ||
| 57 | + * overriding base | ||
| 58 | + */ | ||
| 59 | + if (ctxt->input->free != NULL) { | ||
| 60 | + ctxt->input->free((xmlChar *) ctxt->input->base); | ||
| 61 | + ctxt->input->free = NULL; | ||
| 62 | + } | ||
| 63 | ctxt->input->cur = BAD_CAST""; | ||
| 64 | ctxt->input->base = ctxt->input->cur; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | /** | ||
| 69 | + * xmlStopParser: | ||
| 70 | + * @ctxt: an XML parser context | ||
| 71 | + * | ||
| 72 | + * Blocks further parser processing | ||
| 73 | + */ | ||
| 74 | +void | ||
| 75 | +xmlStopParser(xmlParserCtxtPtr ctxt) { | ||
| 76 | + if (ctxt == NULL) | ||
| 77 | + return; | ||
| 78 | + xmlHaltParser(ctxt); | ||
| 79 | + ctxt->errNo = XML_ERR_USER_STOP; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +/** | ||
| 83 | * xmlCreateIOParserCtxt: | ||
| 84 | * @sax: a SAX handler | ||
| 85 | * @user_data: The user data returned on SAX callbacks | ||
| 86 | -- | ||
| 87 | 2.3.5 | ||
| 88 | |||
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2015-7499-2-Detect-incoherency-on-GROW.patch b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-2-Detect-incoherency-on-GROW.patch new file mode 100644 index 0000000000..aff3920953 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-2-Detect-incoherency-on-GROW.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 35bcb1d758ed70aa7b257c9c3b3ff55e54e3d0da Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Veillard <veillard@redhat.com> | ||
| 3 | Date: Fri, 20 Nov 2015 15:04:09 +0800 | ||
| 4 | Subject: [PATCH] Detect incoherency on GROW | ||
| 5 | |||
| 6 | the current pointer to the input has to be between the base and end | ||
| 7 | if not stop everything we have an internal state error. | ||
| 8 | |||
| 9 | Upstream-Status: Backport | ||
| 10 | |||
| 11 | CVE-2015-7499-2 | ||
| 12 | |||
| 13 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
| 14 | |||
| 15 | --- | ||
| 16 | parser.c | 9 ++++++++- | ||
| 17 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/parser.c b/parser.c | ||
| 20 | index 1810f99..ab007aa 100644 | ||
| 21 | --- a/parser.c | ||
| 22 | +++ b/parser.c | ||
| 23 | @@ -2075,9 +2075,16 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) { | ||
| 24 | ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) && | ||
| 25 | ((ctxt->options & XML_PARSE_HUGE) == 0)) { | ||
| 26 | xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup"); | ||
| 27 | - ctxt->instate = XML_PARSER_EOF; | ||
| 28 | + xmlHaltParser(ctxt); | ||
| 29 | + return; | ||
| 30 | } | ||
| 31 | xmlParserInputGrow(ctxt->input, INPUT_CHUNK); | ||
| 32 | + if ((ctxt->input->cur > ctxt->input->end) || | ||
| 33 | + (ctxt->input->cur < ctxt->input->base)) { | ||
| 34 | + xmlHaltParser(ctxt); | ||
| 35 | + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound"); | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0) && | ||
| 39 | (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) | ||
| 40 | xmlPopInput(ctxt); | ||
| 41 | -- | ||
| 42 | 2.3.5 | ||
| 43 | |||
