153aa9179Sopenharmony_ciFrom 3dc645227ed1ac463c9d333c6eb92d1b6bb26ae9 Mon Sep 17 00:00:00 2001 253aa9179Sopenharmony_ciFrom: Nick Wellnhofer <wellnhofer@aevum.de> 353aa9179Sopenharmony_ciDate: Wed, 15 Feb 2023 14:30:40 +0100 453aa9179Sopenharmony_ciSubject: [PATCH] malloc-fail: Fix memory leak in xmlXPathEqualValuesCommon 553aa9179Sopenharmony_ci 653aa9179Sopenharmony_ciFound with libFuzzer, see #344. 753aa9179Sopenharmony_ci 853aa9179Sopenharmony_ciReference:https://github.com/GNOME/libxml2/commit/3dc645227ed1ac463c9d333c6eb92d1b6bb26ae9 953aa9179Sopenharmony_ciConflict:NA 1053aa9179Sopenharmony_ci--- 1153aa9179Sopenharmony_ci xpath.c | 6 ++++-- 1253aa9179Sopenharmony_ci 1 file changed, 4 insertions(+), 2 deletions(-) 1353aa9179Sopenharmony_ci 1453aa9179Sopenharmony_cidiff --git a/xpath.c b/xpath.c 1553aa9179Sopenharmony_ciindex cf74030..ef9f517 100644 1653aa9179Sopenharmony_ci--- a/xpath.c 1753aa9179Sopenharmony_ci+++ b/xpath.c 1853aa9179Sopenharmony_ci@@ -7028,7 +7028,8 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, 1953aa9179Sopenharmony_ci valuePush(ctxt, arg2); 2053aa9179Sopenharmony_ci xmlXPathNumberFunction(ctxt, 1); 2153aa9179Sopenharmony_ci arg2 = valuePop(ctxt); 2253aa9179Sopenharmony_ci- CHECK_ERROR0; 2353aa9179Sopenharmony_ci+ if (ctxt->error) 2453aa9179Sopenharmony_ci+ break; 2553aa9179Sopenharmony_ci /* Falls through. */ 2653aa9179Sopenharmony_ci case XPATH_NUMBER: 2753aa9179Sopenharmony_ci /* Hand check NaN and Infinity equalities */ 2853aa9179Sopenharmony_ci@@ -7092,7 +7093,8 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, 2953aa9179Sopenharmony_ci valuePush(ctxt, arg1); 3053aa9179Sopenharmony_ci xmlXPathNumberFunction(ctxt, 1); 3153aa9179Sopenharmony_ci arg1 = valuePop(ctxt); 3253aa9179Sopenharmony_ci- CHECK_ERROR0; 3353aa9179Sopenharmony_ci+ if (ctxt->error) 3453aa9179Sopenharmony_ci+ break; 3553aa9179Sopenharmony_ci /* Hand check NaN and Infinity equalities */ 3653aa9179Sopenharmony_ci if (xmlXPathIsNaN(arg1->floatval) || 3753aa9179Sopenharmony_ci xmlXPathIsNaN(arg2->floatval)) { 3853aa9179Sopenharmony_ci-- 3953aa9179Sopenharmony_ci2.27.0 4053aa9179Sopenharmony_ci 4153aa9179Sopenharmony_ci 42