diff options
| author | Theo GAIGE <tgaige.opensource@witekio.com> | 2025-10-02 08:58:32 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-10-14 07:20:35 -0700 |
| commit | bc7377a2390b94c4ddb539562dbe67a5c2e7a804 (patch) | |
| tree | 492d692f1f37121e8dd576b3fca9b3b71473e1c5 | |
| parent | 7f12221f49c32ba320ee175a3f47eb8005db574c (diff) | |
| download | poky-bc7377a2390b94c4ddb539562dbe67a5c2e7a804.tar.gz | |
libxml2: fix CVE-2025-9714
Upstream-Status: Backport from https://gitlab.gnome.org/GNOME/libxml2/-/commit/677a42645ef22b5a50741bad5facf9d8a8bc6d21
(From OE-Core rev: 277692c2472f03ae62401bfbd26e8c4d872113d0)
Signed-off-by: Theo GAIGE <tgaige.opensource@witekio.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/libxml/libxml2/CVE-2025-9714.patch | 117 | ||||
| -rw-r--r-- | meta/recipes-core/libxml/libxml2_2.9.14.bb | 1 |
2 files changed, 118 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2025-9714.patch b/meta/recipes-core/libxml/libxml2/CVE-2025-9714.patch new file mode 100644 index 0000000000..24d1a8348c --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2025-9714.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | From 6ef8b9f05cc21d3fc28156fe5d1251834c29c7d7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nick Wellnhofer <wellnhofer@aevum.de> | ||
| 3 | Date: Thu, 28 Jul 2022 20:21:24 +0200 | ||
| 4 | Subject: [PATCH] Make XPath depth check work with recursive invocations | ||
| 5 | |||
| 6 | EXSLT functions like dyn:map or dyn:evaluate invoke xmlXPathRunEval | ||
| 7 | recursively. Don't set depth to zero but keep and restore the original | ||
| 8 | value to avoid stack overflows when abusing these functions. | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/677a42645ef22b5a50741bad5facf9d8a8bc6d21] | ||
| 11 | CVE: CVE-2025-9714 | ||
| 12 | |||
| 13 | Signed-off-by: Theo GAIGE <tgaige.opensource@witekio.com> | ||
| 14 | --- | ||
| 15 | xpath.c | 23 +++++++++++++++++------ | ||
| 16 | 1 file changed, 17 insertions(+), 6 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/xpath.c b/xpath.c | ||
| 19 | index c2d845888..028471d53 100644 | ||
| 20 | --- a/xpath.c | ||
| 21 | +++ b/xpath.c | ||
| 22 | @@ -13883,12 +13883,11 @@ static int | ||
| 23 | xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) | ||
| 24 | { | ||
| 25 | xmlXPathCompExprPtr comp; | ||
| 26 | + int oldDepth; | ||
| 27 | |||
| 28 | if ((ctxt == NULL) || (ctxt->comp == NULL)) | ||
| 29 | return(-1); | ||
| 30 | |||
| 31 | - ctxt->context->depth = 0; | ||
| 32 | - | ||
| 33 | if (ctxt->valueTab == NULL) { | ||
| 34 | /* Allocate the value stack */ | ||
| 35 | ctxt->valueTab = (xmlXPathObjectPtr *) | ||
| 36 | @@ -13942,11 +13941,13 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) | ||
| 37 | "xmlXPathRunEval: last is less than zero\n"); | ||
| 38 | return(-1); | ||
| 39 | } | ||
| 40 | + oldDepth = ctxt->context->depth; | ||
| 41 | if (toBool) | ||
| 42 | return(xmlXPathCompOpEvalToBoolean(ctxt, | ||
| 43 | &comp->steps[comp->last], 0)); | ||
| 44 | else | ||
| 45 | xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]); | ||
| 46 | + ctxt->context->depth = oldDepth; | ||
| 47 | |||
| 48 | return(0); | ||
| 49 | } | ||
| 50 | @@ -14217,6 +14218,7 @@ xmlXPathCompExprPtr | ||
| 51 | xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { | ||
| 52 | xmlXPathParserContextPtr pctxt; | ||
| 53 | xmlXPathCompExprPtr comp; | ||
| 54 | + int oldDepth = 0; | ||
| 55 | |||
| 56 | #ifdef XPATH_STREAMING | ||
| 57 | comp = xmlXPathTryStreamCompile(ctxt, str); | ||
| 58 | @@ -14230,8 +14232,10 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { | ||
| 59 | if (pctxt == NULL) | ||
| 60 | return NULL; | ||
| 61 | if (ctxt != NULL) | ||
| 62 | - ctxt->depth = 0; | ||
| 63 | + oldDepth = ctxt->depth; | ||
| 64 | xmlXPathCompileExpr(pctxt, 1); | ||
| 65 | + if (ctxt != NULL) | ||
| 66 | + ctxt->depth = oldDepth; | ||
| 67 | |||
| 68 | if( pctxt->error != XPATH_EXPRESSION_OK ) | ||
| 69 | { | ||
| 70 | @@ -14252,8 +14256,10 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { | ||
| 71 | comp = pctxt->comp; | ||
| 72 | if ((comp->nbStep > 1) && (comp->last >= 0)) { | ||
| 73 | if (ctxt != NULL) | ||
| 74 | - ctxt->depth = 0; | ||
| 75 | + oldDepth = ctxt->depth; | ||
| 76 | xmlXPathOptimizeExpression(pctxt, &comp->steps[comp->last]); | ||
| 77 | + if (ctxt != NULL) | ||
| 78 | + ctxt->depth = oldDepth; | ||
| 79 | } | ||
| 80 | pctxt->comp = NULL; | ||
| 81 | } | ||
| 82 | @@ -14409,6 +14415,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { | ||
| 83 | #ifdef XPATH_STREAMING | ||
| 84 | xmlXPathCompExprPtr comp; | ||
| 85 | #endif | ||
| 86 | + int oldDepth = 0; | ||
| 87 | |||
| 88 | if (ctxt == NULL) return; | ||
| 89 | |||
| 90 | @@ -14422,8 +14429,10 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { | ||
| 91 | #endif | ||
| 92 | { | ||
| 93 | if (ctxt->context != NULL) | ||
| 94 | - ctxt->context->depth = 0; | ||
| 95 | + oldDepth = ctxt->context->depth; | ||
| 96 | xmlXPathCompileExpr(ctxt, 1); | ||
| 97 | + if (ctxt->context != NULL) | ||
| 98 | + ctxt->context->depth = oldDepth; | ||
| 99 | CHECK_ERROR; | ||
| 100 | |||
| 101 | /* Check for trailing characters. */ | ||
| 102 | @@ -14432,9 +14441,11 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { | ||
| 103 | |||
| 104 | if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) { | ||
| 105 | if (ctxt->context != NULL) | ||
| 106 | - ctxt->context->depth = 0; | ||
| 107 | + oldDepth = ctxt->context->depth; | ||
| 108 | xmlXPathOptimizeExpression(ctxt, | ||
| 109 | &ctxt->comp->steps[ctxt->comp->last]); | ||
| 110 | + if (ctxt->context != NULL) | ||
| 111 | + ctxt->context->depth = oldDepth; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | -- | ||
| 116 | 2.43.0 | ||
| 117 | |||
diff --git a/meta/recipes-core/libxml/libxml2_2.9.14.bb b/meta/recipes-core/libxml/libxml2_2.9.14.bb index f34b0c25ca..932251da98 100644 --- a/meta/recipes-core/libxml/libxml2_2.9.14.bb +++ b/meta/recipes-core/libxml/libxml2_2.9.14.bb | |||
| @@ -42,6 +42,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar;subdir=${BP};name=testt | |||
| 42 | file://CVE-2025-6021.patch \ | 42 | file://CVE-2025-6021.patch \ |
| 43 | file://CVE-2025-49794-CVE-2025-49796.patch \ | 43 | file://CVE-2025-49794-CVE-2025-49796.patch \ |
| 44 | file://CVE-2025-6170.patch \ | 44 | file://CVE-2025-6170.patch \ |
| 45 | file://CVE-2025-9714.patch \ | ||
| 45 | " | 46 | " |
| 46 | 47 | ||
| 47 | SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" | 48 | SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" |
