diff --git a/0002-Issue-656-protect-against-NULL-node-set-in-loop.patch b/0002-Issue-656-protect-against-NULL-node-set-in-loop.patch new file mode 100644 index 0000000..2b87ed9 --- /dev/null +++ b/0002-Issue-656-protect-against-NULL-node-set-in-loop.patch @@ -0,0 +1,29 @@ +From a0414d65a69927808240e41c1235145413978c43 Mon Sep 17 00:00:00 2001 +From: Geoff McLane +Date: Sat, 16 Dec 2017 20:54:29 +0100 +Subject: [PATCH 02/12] Issue #656 - protect against NULL node set in loop + +--- + src/clean.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/clean.c b/src/clean.c +index de4caf5..e96dd3f 100644 +--- a/src/clean.c ++++ b/src/clean.c +@@ -2211,8 +2211,10 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc) + tidyBufAppend(&charsetString, "charset=", 8); + tidyBufAppend(&charsetString, (char*)enc, TY_(tmbstrlen)(enc)); + tidyBufAppend(&charsetString, "\0", 1); /* zero terminate the buffer */ +- /* process the children of the head */ +- for (currentNode = head->content; currentNode; currentNode = currentNode->next) ++ /* process the children of the head */ ++ /* Issue #656 - guard against 'currentNode' being set NULL in loop */ ++ for (currentNode = head->content; currentNode; ++ currentNode = (currentNode ? currentNode->next : NULL)) + { + if (!nodeIsMETA(currentNode)) + continue; /* not a meta node */ +-- +2.14.3 + diff --git a/tidy-html5-5.6.0.tar.gz b/tidy-html5-5.6.0.tar.gz new file mode 100644 index 0000000..b94e0ad Binary files /dev/null and b/tidy-html5-5.6.0.tar.gz differ diff --git a/tidy.spec b/tidy.spec new file mode 100644 index 0000000..b5edaa5 --- /dev/null +++ b/tidy.spec @@ -0,0 +1,84 @@ +%global libname libtidy +%global upname tidy-html5 + +Name: tidy +Version: 5.6.0 +Release: 1 +Summary: Utility to clean up and pretty print HTML/XHTML/XML +License: W3C +URL: http://www.html-tidy.org/ +Source0: https://github.com/htacg/%{upname}/archive/%{upname}-%{version}.tar.gz + +Patch0001: 0002-Issue-656-protect-against-NULL-node-set-in-loop.patch + +BuildRequires: gcc-c++ cmake gcc libxslt pkgconfig +Provides: tidy-html5 = %{version}-%{release} +Requires: %{libname}%{?_isa} = %{version}-%{release} + +%description +When editing HTML it's easy to make mistakes. Wouldn't it be nice if +there was a simple way to fix these mistakes automatically and tidy up +sloppy editing into nicely laid out markup? Well now there is! Dave +Raggett's HTML TIDY is a free utility for doing just that. It also +works great on the atrociously hard to read markup generated by +specialized HTML editors and conversion tools, and can help you +identify where you need to pay further attention on making your pages +more accessible to people with disabilities. + +%package -n %{libname} +Summary: Runtime library for %{name} +%description -n %{libname} +%{summary}. + +%package -n %{libname}-devel +Summary: Development files for %{name} +Obsoletes: tidy-devel < 0.99.0-10 +Provides: tidy-devel = %{version}-%{release} +Requires: %{libname}%{?_isa} = %{version}-%{release} +%description -n %{libname}-devel +%{summary}. + +%package_help + +%prep +%autosetup -n %{upname}-%{version} -p1 +ln -s tidy build/cmake/tidy5 + +%build +pushd build/cmake +%cmake ../../ \ + -DCMAKE_BUILD_TYPE:STRING=Release +popd +%make_build -C build/cmake + +%install +%make_install -C build/cmake +ln -s tidybuffio.h $RPM_BUILD_ROOT%{_includedir}/buffio.h +ln -s tidyplatform.h $RPM_BUILD_ROOT%{_includedir}/platform.h +%delete_la_and_a + +%ldconfig_scriptlets -n %{libname} + +%files +%defattr(-,root,root,-) +%license README/LICENSE.md +%{_bindir}/tidy + +%files -n %{libname} +%defattr(-,root,root,-) +%license README/LICENSE.md +%{_libdir}/libtidy.so.5* + +%files -n %{libname}-devel +%defattr(-,root,root) +%{_includedir}/*.h +%{_libdir}/libtidy.so +%{_libdir}/pkgconfig/tidy.pc + +%files help +%defattr(-,root,root) +%{_mandir}/* + +%changelog +* Wed Feb 12 2020 openEuler Buildteam - 5.6.0-1 +- Package init