public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-perl/XML-LibXML/files/, dev-perl/XML-LibXML/
@ 2023-05-12 23:50 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2023-05-12 23:50 UTC (permalink / raw
  To: gentoo-commits

commit:     23ea36dfba863f53e66a3a9f73aeec9124dd9aa5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 23:42:16 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 12 23:42:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23ea36df

dev-perl/XML-LibXML: fix modern C issues

Closes: https://bugs.gentoo.org/883711
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-perl/XML-LibXML/XML-LibXML-2.20.800-r1.ebuild  | 82 ++++++++++++++++++++++
 .../files/XML-LibXML-2.20.800-modern-c.patch       | 45 ++++++++++++
 2 files changed, 127 insertions(+)

diff --git a/dev-perl/XML-LibXML/XML-LibXML-2.20.800-r1.ebuild b/dev-perl/XML-LibXML/XML-LibXML-2.20.800-r1.ebuild
new file mode 100644
index 000000000000..bd3938b77c2c
--- /dev/null
+++ b/dev-perl/XML-LibXML/XML-LibXML-2.20.800-r1.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DIST_AUTHOR=SHLOMIF
+DIST_VERSION=2.0208
+DIST_EXAMPLES=("example/*")
+inherit perl-module
+
+DESCRIPTION="Perl binding for libxml2"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
+IUSE="minimal"
+
+# >= on XML-Sax needed to avoid "miscompilation" (essentially empty install), as newer XML-Sax
+# has the ROOT check fixed. Didn't happen with XML-SAX-Expat, but best to be careful.
+# bug #840053
+RDEPEND="
+	virtual/perl-Carp
+	virtual/perl-Encode
+	>=virtual/perl-Exporter-5.570.0
+	virtual/perl-IO
+	virtual/perl-Scalar-List-Utils
+	>=dev-perl/XML-NamespaceSupport-1.70.0
+	>=dev-perl/XML-SAX-1.20.0-r1
+	dev-perl/XML-SAX-Base
+	>=dev-libs/libxml2-2.6.21:2=
+	virtual/perl-parent
+"
+BDEPEND="${RDEPEND}
+	virtual/perl-ExtUtils-MakeMaker
+	dev-perl/Alien-Build
+	>=dev-perl/Alien-Libxml2-0.140.0
+	test? (
+		!minimal? (
+			dev-perl/Test-LeakTrace
+		)
+	)
+"
+DEPEND=">=dev-libs/libxml2-2.6.21:2="
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.20.800-modern-c.patch
+)
+
+PERL_RM_FILES=(
+	"t/cpan-changes.t" "t/pod-files-presence.t" "t/pod.t"
+	"t/release-kwalitee.t" "t/style-trailing-space.t"
+	"t/11memory.t"
+)
+
+src_compile() {
+	export SKIP_SAX_INSTALL=1
+	perl-module_src_compile
+}
+
+pkg_postinst() {
+	pkg_update_parser add XML::LibXML::SAX::Parser
+	pkg_update_parser add XML::LibXML::SAX
+}
+
+pkg_postrm() {
+	pkg_update_parser remove XML::LibXML::SAX::Parser
+	pkg_update_parser remove XML::LibXML::SAX
+}
+
+pkg_update_parser() {
+	# pkg_update_parser [add|remove] $parser_module
+	local action=$1
+	local parser_module=$2
+
+	if [[ -z "${ROOT}" ]] ; then
+		einfo "Update Parser: $1 $2"
+		perl -MXML::SAX -e "XML::SAX->${action}_parser(q(${parser_module}))->save_parsers()" \
+			|| ewarn "Update Parser: $1 $2 failed"
+	else
+		elog "To $1 $2 run:"
+		elog "perl -MXML::SAX -e 'XML::SAX->${action}_parser(q(${parser_module}))->save_parsers()'"
+	fi
+}

diff --git a/dev-perl/XML-LibXML/files/XML-LibXML-2.20.800-modern-c.patch b/dev-perl/XML-LibXML/files/XML-LibXML-2.20.800-modern-c.patch
new file mode 100644
index 000000000000..609db4ac7123
--- /dev/null
+++ b/dev-perl/XML-LibXML/files/XML-LibXML-2.20.800-modern-c.patch
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/883711
+https://github.com/shlomif/perl-XML-LibXML/pull/75
+
+From 25451c0a56ef8d3b32fd23847bef516486bd8ed4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 16 Jan 2023 18:50:10 -0800
+Subject: [PATCH] libxml-mm: Fix function prototypes in function pointers
+
+This is now detected with latest clang16+
+
+Fixes
+error: incompatible function pointer types passing 'void (void *, void *, xmlChar *)' (aka 'void (void *, void *, unsigned char *)') to parameter of type 'xmlHashScanner' (aka 'void (*)(void *, void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
+                xmlHashScan(r, PmmRegistryDumpHashScanner, NULL);
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/perl-libxml-mm.c
++++ b/perl-libxml-mm.c
+@@ -121,7 +121,7 @@ PmmFreeHashTable(xmlHashTablePtr table)
+ extern SV* PROXY_NODE_REGISTRY_MUTEX;
+ 
+ /* Utility method used by PmmDumpRegistry */
+-void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name)
++void PmmRegistryDumpHashScanner(void * payload, void * data, const xmlChar * name)
+ {
+ 	LocalProxyNodePtr lp = (LocalProxyNodePtr) payload;
+ 	ProxyNodePtr node = (ProxyNodePtr) lp->proxy;
+@@ -215,7 +215,7 @@ PmmRegisterProxyNode(ProxyNodePtr proxy)
+ /* PP: originally this was static inline void, but on AIX the compiler
+    did not chew it, so I'm removing the inline */
+ static void
+-PmmRegistryHashDeallocator(void *payload, xmlChar *name)
++PmmRegistryHashDeallocator(void *payload, const xmlChar *name)
+ {
+ 	Safefree((LocalProxyNodePtr) payload);
+ }
+@@ -279,7 +279,7 @@ PmmRegistryREFCNT_dec(ProxyNodePtr proxy)
+  * internal, used by PmmCloneProxyNodes
+  */
+ void *
+-PmmRegistryHashCopier(void *payload, xmlChar *name)
++PmmRegistryHashCopier(void *payload, const xmlChar *name)
+ {
+ 	ProxyNodePtr proxy = ((LocalProxyNodePtr) payload)->proxy;
+ 	LocalProxyNodePtr lp;
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-perl/XML-LibXML/files/, dev-perl/XML-LibXML/
@ 2016-12-30 16:41 Andreas Hüttel
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Hüttel @ 2016-12-30 16:41 UTC (permalink / raw
  To: gentoo-commits

commit:     6ab4da0dccbc2a77285e0c200d2ee3df58249ec6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 30 16:40:18 2016 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 30 16:40:53 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ab4da0d

dev-perl/XML-LibXML: Disable expanding external entities by default, bug 594614

Patch by ppisar <AT> redhat.com
https://rt.cpan.org/Public/Bug/Display.html?id=118032
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838097
https://bugzilla.redhat.com/show_bug.cgi?id=1377996

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 dev-perl/XML-LibXML/XML-LibXML-2.12.800-r1.ebuild  | 70 +++++++++++++++++++++
 .../XML-LibXML-2.12.800-disable-expanding.patch    | 72 ++++++++++++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/dev-perl/XML-LibXML/XML-LibXML-2.12.800-r1.ebuild b/dev-perl/XML-LibXML/XML-LibXML-2.12.800-r1.ebuild
new file mode 100644
index 00000000..75c4674
--- /dev/null
+++ b/dev-perl/XML-LibXML/XML-LibXML-2.12.800-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+DIST_AUTHOR=SHLOMIF
+DIST_VERSION=2.0128
+DIST_EXAMPLES=("example/*")
+inherit perl-module
+
+DESCRIPTION="Perl binding for libxml2"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="test minimal"
+
+RDEPEND="
+	>=dev-perl/XML-SAX-0.120.0
+	>=dev-libs/libxml2-2.6.21
+	dev-perl/XML-SAX-Base
+	>=dev-perl/XML-NamespaceSupport-1.70.0
+"
+DEPEND="${RDEPEND}
+	virtual/perl-ExtUtils-MakeMaker
+	test? (
+		!minimal? (
+			dev-perl/Test-LeakTrace
+		)
+	)
+"
+
+PATCHES=(
+	"${FILESDIR}/${P}-disable-expanding.patch"
+)
+
+src_compile() {
+	export SKIP_SAX_INSTALL=1
+	perl-module_src_compile
+}
+
+src_test() {
+	perl_rm_files t/pod.t t/style-trailing-space.t t/cpan-changes.t
+	perl-module_src_test
+}
+
+pkg_postinst() {
+	pkg_update_parser add XML::LibXML::SAX::Parser
+	pkg_update_parser add XML::LibXML::SAX
+}
+
+pkg_postrm() {
+	pkg_update_parser remove XML::LibXML::SAX::Parser
+	pkg_update_parser remove XML::LibXML::SAX
+}
+
+pkg_update_parser() {
+	# pkg_update_parser [add|remove] $parser_module
+	local action=$1
+	local parser_module=$2
+
+	if [[ "$ROOT" = "/" ]] ; then
+		einfo "Update Parser: $1 $2"
+		perl -MXML::SAX -e "XML::SAX->${action}_parser(q(${parser_module}))->save_parsers()" \
+			|| ewarn "Update Parser: $1 $2 failed"
+	else
+		elog "To $1 $2 run:"
+		elog "perl -MXML::SAX -e 'XML::SAX->${action}_parser(q(${parser_module}))->save_parsers()'"
+	fi
+}

diff --git a/dev-perl/XML-LibXML/files/XML-LibXML-2.12.800-disable-expanding.patch b/dev-perl/XML-LibXML/files/XML-LibXML-2.12.800-disable-expanding.patch
new file mode 100644
index 00000000..8be7783
--- /dev/null
+++ b/dev-perl/XML-LibXML/files/XML-LibXML-2.12.800-disable-expanding.patch
@@ -0,0 +1,72 @@
+From 05749ae525317d05bd9d4232c080e530854f1d88 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 30 Sep 2016 14:31:26 +0200
+Subject: [PATCH] Do not enable expanding entities by default
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Expanding external entity is insecure.
+<https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing>.
+This patch makes expand_entities option disabled by default.
+
+CPAN RT#118032
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ LibXML.pm       | 2 +-
+ docs/libxml.dbk | 2 +-
+ t/43options.t   | 4 ++--
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/LibXML.pm b/LibXML.pm
+index eb3cbd6..9ab4748 100644
+--- a/LibXML.pm
++++ b/LibXML.pm
+@@ -261,7 +261,7 @@ use constant {
+   HTML_PARSE_NOERROR  => (1<<5),       # suppress error reports
+ };
+ 
+-$XML_LIBXML_PARSE_DEFAULTS = ( XML_PARSE_NODICT | XML_PARSE_DTDLOAD | XML_PARSE_NOENT );
++$XML_LIBXML_PARSE_DEFAULTS = ( XML_PARSE_NODICT | XML_PARSE_DTDLOAD );
+ 
+ # this hash is made global so that applications can add names for new
+ # libxml2 parser flags as temporary workaround
+diff --git a/docs/libxml.dbk b/docs/libxml.dbk
+index 30f279b..2c6674b 100644
+--- a/docs/libxml.dbk
++++ b/docs/libxml.dbk
+@@ -1676,7 +1676,7 @@ local $XML::LibXML::setTagCompression = 1;</programlisting>
+             <term>expand_entities</term>
+             <listitem>
+ 	      <para>/parser, reader/</para>
+-              <para>substitute entities; possible values are 0 and 1; default is 1</para>
++              <para>substitute entities; possible values are 0 and 1; default is 0</para>
+ 	      <para>Note that although this flag disables entity substitution, it
+ 	      does not prevent the parser from loading external entities;
+ 	      when substitution of an external entity is disabled, the
+diff --git a/t/43options.t b/t/43options.t
+index 826f0ad..53dd35e 100644
+--- a/t/43options.t
++++ b/t/43options.t
+@@ -50,7 +50,7 @@ no_network
+ {
+   my $p = XML::LibXML->new();
+   for my $opt (@all) {
+-    my $ret = (($opt =~ /^(?:load_ext_dtd|expand_entities)$/) ? 1 : 0);
++    my $ret = (($opt =~ /^(?:load_ext_dtd)$/) ? 1 : 0);
+     # TEST*$all
+     ok(
+         ($p->get_option($opt)||0) == $ret
+@@ -110,7 +110,7 @@ no_network
+   ok( $p->get_option('recover') == 2, ' TODO : Add test name' );
+ 
+   # TEST
+-  ok( $p->expand_entities() == 1, ' TODO : Add test name' );
++  ok( $p->expand_entities() == 0, ' TODO : Add test name' );
+   # TEST
+   ok( $p->load_ext_dtd() == 1, ' TODO : Add test name' );
+   $p->load_ext_dtd(0);
+-- 
+2.7.4
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-12 23:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12 23:50 [gentoo-commits] repo/gentoo:master commit in: dev-perl/XML-LibXML/files/, dev-perl/XML-LibXML/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2016-12-30 16:41 Andreas Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox