Signed-off-by: Alexander Dahl <[email protected]> --- ...mory-leak-in-xmlSchemaValidateStream.patch | 29 +++++++++++++++++++ patches/libxml2-2.9.10/series | 3 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 patches/libxml2-2.9.10/0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch
diff --git a/patches/libxml2-2.9.10/0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch b/patches/libxml2-2.9.10/0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch new file mode 100644 index 000000000..1ca086217 --- /dev/null +++ b/patches/libxml2-2.9.10/0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch @@ -0,0 +1,29 @@ +From: Zhipeng Xie <[email protected]> +Date: Tue, 20 Aug 2019 16:33:06 +0800 +Subject: [PATCH] Fix memory leak in xmlSchemaValidateStream + +When ctxt->schema is NULL, xmlSchemaSAXPlug->xmlSchemaPreRun +alloc a new schema for ctxt->schema and set vctxt->xsiAssemble +to 1. Then xmlSchemaVStart->xmlSchemaPreRun initialize +vctxt->xsiAssemble to 0 again which cause the alloced schema +can not be freed anymore. + +Found with libFuzzer. + +Signed-off-by: Zhipeng Xie <[email protected]> +--- + xmlschemas.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/xmlschemas.c b/xmlschemas.c +index d19de6df5f50..59495c2738ab 100644 +--- a/xmlschemas.c ++++ b/xmlschemas.c +@@ -28095,7 +28095,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { + vctxt->nberrors = 0; + vctxt->depth = -1; + vctxt->skipDepth = -1; +- vctxt->xsiAssemble = 0; + vctxt->hasKeyrefs = 0; + #ifdef ENABLE_IDC_NODE_TABLES_TEST + vctxt->createIDCNodeTables = 1; diff --git a/patches/libxml2-2.9.10/series b/patches/libxml2-2.9.10/series index b8e92fb7a..fed72960d 100644 --- a/patches/libxml2-2.9.10/series +++ b/patches/libxml2-2.9.10/series @@ -2,6 +2,7 @@ #tag:base --start-number 1 #tag:upstream --start-number 1 0001-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch #tag:ptx --start-number 200 0200-xml2-config-is-not-SYSROOT-aware.patch -# 0a9081f5db07b8cbb593bc669a7603c7 - git-ptx-patches magic +# d6f49636e8813a3a9e46758f352fc667 - git-ptx-patches magic -- 2.20.1 _______________________________________________ ptxdist mailing list [email protected]
