tidy:fix memleak

This commit is contained in:
lunankun 2020-11-20 17:16:21 +08:00
parent 0da1a22c33
commit c8ca06f87d
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 4377ab84a4a2748d72be91d26210567cc933c760 Mon Sep 17 00:00:00 2001
From: lutianxiong <lutianxiong@huawei.com>
Date: Sat, 20 Jun 2020 09:19:17 +0800
Subject: [PATCH 095/109] fix memleak in GetTokenFromStream
check asp & php if ParseAttribute return NULL
---
src/lexer.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/lexer.c b/src/lexer.c
index ca66aee..bbc1e15 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -3263,6 +3263,22 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
if (!name)
{
+ /* check if attributes are created by ASP markup */
+ if (asp)
+ {
+ av = TY_(NewAttribute)(doc);
+ av->asp = asp;
+ AddAttrToList( &attributes, av );
+ }
+
+ /* check if attributes are created by PHP markup */
+ if (php)
+ {
+ av = TY_(NewAttribute)(doc);
+ av->php = php;
+ AddAttrToList( &attributes, av );
+ }
+
/* fix for http://tidy.sf.net/bug/788031 */
lexer->lexsize -= 1;
lexer->txtend = lexer->txtstart;
--
1.8.3.1

View File

@ -3,13 +3,14 @@
Name: tidy Name: tidy
Version: 5.6.0 Version: 5.6.0
Release: 2 Release: 3
Summary: Utility to clean up and pretty print HTML/XHTML/XML Summary: Utility to clean up and pretty print HTML/XHTML/XML
License: W3C License: W3C
URL: http://www.html-tidy.org/ URL: http://www.html-tidy.org/
Source0: https://github.com/htacg/%{upname}/archive/%{version}.tar.gz#/%{upname}-%{version}.tar.gz Source0: https://github.com/htacg/%{upname}/archive/%{version}.tar.gz#/%{upname}-%{version}.tar.gz
Patch0001: 0002-Issue-656-protect-against-NULL-node-set-in-loop.patch Patch0001: 0002-Issue-656-protect-against-NULL-node-set-in-loop.patch
Patch0002: fix-memleak-in-GetTokenFromStream.patch
BuildRequires: gcc-c++ cmake gcc libxslt pkgconfig BuildRequires: gcc-c++ cmake gcc libxslt pkgconfig
Provides: tidy-html5 = %{version}-%{release} Provides: tidy-html5 = %{version}-%{release}
@ -80,6 +81,12 @@ ln -s tidyplatform.h $RPM_BUILD_ROOT%{_includedir}/platform.h
%{_mandir}/* %{_mandir}/*
%changelog %changelog
* Fri Nov 20 2020 lunankun <lunankun@huawei.com> - 5.6.0-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix memleak
* Wed Sep 02 2020 gaihuiying <gaihuiying1@huawei.com> - 5.6.0-2 * Wed Sep 02 2020 gaihuiying <gaihuiying1@huawei.com> - 5.6.0-2
- Type:bugfix - Type:bugfix
- DESC:change Source0 to correct URL - DESC:change Source0 to correct URL