Package init
This commit is contained in:
parent
87a2c943fd
commit
44330f908d
129
fix-xmlSecParseMemory-memory-leak-issue-199-202.patch
Normal file
129
fix-xmlSecParseMemory-memory-leak-issue-199-202.patch
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
From 477d91c30f0ba433a35e3d6bcf69ea5ef3f75a5f Mon Sep 17 00:00:00 2001
|
||||||
|
From: lsh123 <aleksey@aleksey.com>
|
||||||
|
Date: Mon, 2 Jul 2018 16:48:09 -0700
|
||||||
|
Subject: [PATCH] fix xmlSecParseMemory() memory leak (issue #199) (#202)
|
||||||
|
|
||||||
|
---
|
||||||
|
src/parser.c | 35 +++++++++++++++++++++++++++++++----
|
||||||
|
src/xslt.c | 4 ++++
|
||||||
|
2 files changed, 35 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/parser.c b/src/parser.c
|
||||||
|
index e18b2d3..ddeb590 100644
|
||||||
|
--- a/src/parser.c
|
||||||
|
+++ b/src/parser.c
|
||||||
|
@@ -132,6 +132,10 @@ xmlSecParserFinalize(xmlSecTransformPtr transform) {
|
||||||
|
xmlSecAssert(ctx != NULL);
|
||||||
|
|
||||||
|
if(ctx->parserCtx != NULL) {
|
||||||
|
+ if(ctx->parserCtx->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctx->parserCtx->myDoc);
|
||||||
|
+ ctx->parserCtx->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctx->parserCtx);
|
||||||
|
}
|
||||||
|
memset(ctx, 0, sizeof(xmlSecParserCtx));
|
||||||
|
@@ -294,6 +298,10 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
|
||||||
|
xmlSecXmlParserError("inputPush", ctxt,
|
||||||
|
xmlSecTransformGetName(transform));
|
||||||
|
xmlFreeInputStream(input);
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
@@ -404,20 +412,27 @@ xmlSecParseFile(const char *filename) {
|
||||||
|
xmlSecXmlParserError2("xmlParseDocument", ctxt, NULL,
|
||||||
|
"filename=%s",
|
||||||
|
xmlSecErrorsSafeString(filename));
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ctxt->wellFormed) {
|
||||||
|
xmlSecInternalError("document is not well formed", NULL);
|
||||||
|
- xmlFreeDoc(ctxt->myDoc);
|
||||||
|
- ctxt->myDoc = NULL;
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
res = ctxt->myDoc;
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(res);
|
||||||
|
|
||||||
|
@@ -495,9 +510,14 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
doc = ctxt->myDoc;
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if(ctxt != NULL) {
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
}
|
||||||
|
return(doc);
|
||||||
|
@@ -536,20 +556,27 @@ xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) {
|
||||||
|
ret = xmlParseDocument(ctxt);
|
||||||
|
if(ret < 0) {
|
||||||
|
xmlSecXmlParserError("xmlParseDocument", ctxt, NULL);
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(ctxt->wellFormed) && !recovery) {
|
||||||
|
xmlSecInternalError("document is not well formed", NULL);
|
||||||
|
- xmlFreeDoc(ctxt->myDoc);
|
||||||
|
- ctxt->myDoc = NULL;
|
||||||
|
+ if(ctxt->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctxt->myDoc);
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
res = ctxt->myDoc;
|
||||||
|
+ ctxt->myDoc = NULL;
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(res);
|
||||||
|
}
|
||||||
|
diff --git a/src/xslt.c b/src/xslt.c
|
||||||
|
index 2f43e41..1822cdc 100644
|
||||||
|
--- a/src/xslt.c
|
||||||
|
+++ b/src/xslt.c
|
||||||
|
@@ -219,6 +219,10 @@ xmlSecXsltFinalize(xmlSecTransformPtr transform) {
|
||||||
|
xsltFreeStylesheet(ctx->xslt);
|
||||||
|
}
|
||||||
|
if(ctx->parserCtx != NULL) {
|
||||||
|
+ if(ctx->parserCtx->myDoc != NULL) {
|
||||||
|
+ xmlFreeDoc(ctx->parserCtx->myDoc);
|
||||||
|
+ ctx->parserCtx->myDoc = NULL;
|
||||||
|
+ }
|
||||||
|
xmlFreeParserCtxt(ctx->parserCtx);
|
||||||
|
}
|
||||||
|
memset(ctx, 0, sizeof(xmlSecXsltCtx));
|
||||||
|
--
|
||||||
|
1.7.12.4
|
||||||
|
|
||||||
13
xmlsec1.spec
13
xmlsec1.spec
@ -1,6 +1,6 @@
|
|||||||
Name: xmlsec1
|
Name: xmlsec1
|
||||||
Version: 1.2.25
|
Version: 1.2.25
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: A C library based on LibXML2
|
Summary: A C library based on LibXML2
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://www.aleksey.com/xmlsec
|
URL: http://www.aleksey.com/xmlsec
|
||||||
@ -8,6 +8,7 @@ Source0: http://www.aleksey.com/xmlsec/download/xmlsec1-%{version}.tar
|
|||||||
|
|
||||||
# Path1 get from fedora
|
# Path1 get from fedora
|
||||||
Patch1: xmlSecOpenSSLX509DataNodeRead-error.patch
|
Patch1: xmlSecOpenSSLX509DataNodeRead-error.patch
|
||||||
|
Patch6000: fix-xmlSecParseMemory-memory-leak-issue-199-202.patch
|
||||||
|
|
||||||
BuildRequires: pkgconfig(libxml-2.0) >= 2.8.0 pkgconfig(libxslt) >= 1.0.20 pkgconfig(openssl) >= 1.0.0
|
BuildRequires: pkgconfig(libxml-2.0) >= 2.8.0 pkgconfig(libxslt) >= 1.0.20 pkgconfig(openssl) >= 1.0.0
|
||||||
BuildRequires: pkgconfig(nss) >= 3.11.1 pkgconfig(nspr) >= 4.4.1 libgcrypt-devel >= 1.4.0 libtool
|
BuildRequires: pkgconfig(nss) >= 3.11.1 pkgconfig(nspr) >= 4.4.1 libgcrypt-devel >= 1.4.0 libtool
|
||||||
@ -30,12 +31,7 @@ Obsoletes: xmlsec1-openssl-devel xmlsec1-gcrypt-devel xmlsec1-gnutls-dev
|
|||||||
%description devel
|
%description devel
|
||||||
This package contains the libraries and develop content for the xmlsec library.
|
This package contains the libraries and develop content for the xmlsec library.
|
||||||
|
|
||||||
%package help
|
%package_help
|
||||||
Summary: Help documentation related to xmlsec library
|
|
||||||
Buildarch: noarch
|
|
||||||
|
|
||||||
%description help
|
|
||||||
This package includes help documentation and manuals related to xmlsec library.
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1
|
%autosetup -p1
|
||||||
@ -83,5 +79,8 @@ mv %{buildroot}%{_docdir}/xmlsec1/* __tmp_doc
|
|||||||
%{_mandir}/man1/*.1.*
|
%{_mandir}/man1/*.1.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Dec 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.2.25-7
|
||||||
|
- Fix xmlSecParseMemory() memory leak
|
||||||
|
|
||||||
* Thu Sep 19 2019 dongjian <dongjian13@huawei.com> - 1.2.25-6
|
* Thu Sep 19 2019 dongjian <dongjian13@huawei.com> - 1.2.25-6
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user