From f20630d63e8d5ed4d7d5e99cb63ba3e212eef7e9 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 23:59:45 +0100 Subject: [PATCH] patch from lfs to fix segmentation fault seen on x86 [release 2.0.4-2mamba;Sun Nov 26 2017] --- itstool-2.0.4-x86-segfault.patch | 55 ++++++++++++++++++++++++++++++++ itstool.spec | 10 ++++-- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 itstool-2.0.4-x86-segfault.patch diff --git a/itstool-2.0.4-x86-segfault.patch b/itstool-2.0.4-x86-segfault.patch new file mode 100644 index 0000000..05e21cb --- /dev/null +++ b/itstool-2.0.4-x86-segfault.patch @@ -0,0 +1,55 @@ +Submitted by: DJ Lucas (dj_AT_linuxfromscratch_DOT_org) +Date: 2017-10-26 +Initial Package Version: 2.0.4 +Upstream Status: Comitted +Origin: https://github.com/itstool/itstool/commit/9b84c007a73e8275ca45762f1bfa3ab7c3a852e2 +Description: Fixes memory exhaustion when freeing XML docs. + + +diff -Naur a/itstool.in b/itstool.in +--- a/itstool.in ++++ a/itstool.in +@@ -477,6 +477,7 @@ class Document (object): + if load_dtd: + ctxt.loadSubset(1) + if keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1043,6 +1044,7 @@ class Document (object): + if self._load_dtd: + ctxt.loadSubset(1) + if self._keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1069,7 +1071,9 @@ class Document (object): + ph_node = msg.get_placeholder(child.name).node + if self.has_child_elements(ph_node): + self.merge_translations(translations, None, ph_node, strict=strict) +- child.replaceNode(ph_node) ++ newnode = ph_node.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ child.replaceNode(newnode) + else: + repl = self.get_translated(ph_node, translations, strict=strict, lang=lang) + child.replaceNode(repl) +@@ -1084,10 +1088,15 @@ class Document (object): + (lang + ' ') if lang is not None else '', + msgstr.encode('utf-8'))) + self._xml_err = '' ++ ctxt.doc().freeDoc() + return node + retnode = node.copyNode(2) ++ retnode.setTreeDoc(self._doc) + for child in xml_child_iter(trnode): +- retnode.addChild(child.copyNode(1)) ++ newnode = child.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ retnode.addChild(newnode) ++ + ctxt.doc().freeDoc() + return retnode + diff --git a/itstool.spec b/itstool.spec index acbc666..2d9bf46 100644 --- a/itstool.spec +++ b/itstool.spec @@ -1,6 +1,6 @@ Name: itstool Version: 2.0.4 -Release: 1mamba +Release: 2mamba Summary: A tool to translate XML documents with PO files Group: Development/Tools Vendor: openmamba @@ -8,6 +8,7 @@ Distribution: openmamba Packager: Silvan Calarco URL: http://itstool.org/ Source: http://files.itstool.org/itstool/itstool-%{version}.tar.bz2 +Patch0: itstool-2.0.4-x86-segfault.patch License: GPL ## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-END @@ -20,6 +21,8 @@ ITS Tool allows you to translate your XML documents with PO files, using rules f %prep %setup -q +%patch0 -p1 + sed -i "s|%{_bindir}/python|%{_bindir}/python2.7|" itstool.in %build @@ -39,10 +42,13 @@ sed -i "s|%{_bindir}/python|%{_bindir}/python2.7|" itstool.in %dir %{_datadir}/itstool %dir %{_datadir}/itstool/its %{_datadir}/itstool/its/*.its -%{_mandir}/man1/itstool.1.gz +%{_mandir}/man1/itstool.1* %doc COPYING %changelog +* Sun Nov 26 2017 Silvan Calarco 2.0.4-2mamba +- patch from lfs to fix segmentation fault seen on x86 + * Sat Oct 21 2017 Automatic Build System 2.0.4-1mamba - automatic update by autodist