[libxml-libxml-perl] 01/03: Add Preserve-unset-options-after-a-_clone-call.patch patch
Salvatore Bonaccorso
carnil at debian.org
Mon Apr 27 18:44:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
carnil pushed a commit to branch master
in repository libxml-libxml-perl.
commit a97182467227ed59b4485236a1513913082fd0ed
Author: Salvatore Bonaccorso <carnil at debian.org>
Date: Mon Apr 27 20:29:21 2015 +0200
Add Preserve-unset-options-after-a-_clone-call.patch patch
Preserve unset options after a _clone() call (e.g: in load_xml()).
Closes: #783443
---
...reserve-unset-options-after-a-_clone-call.patch | 80 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 81 insertions(+)
diff --git a/debian/patches/Preserve-unset-options-after-a-_clone-call.patch b/debian/patches/Preserve-unset-options-after-a-_clone-call.patch
new file mode 100644
index 0000000..e99e282
--- /dev/null
+++ b/debian/patches/Preserve-unset-options-after-a-_clone-call.patch
@@ -0,0 +1,80 @@
+Description: Preserve unset options after a _clone() call (e.g: in load_xml())
+Origin: upstream, https://bitbucket.org/shlomif/perl-xml-libxml/commits/5962fd067580767777e94640b129ae8930a68a30
+Bug-Debian: https://bugs.debian.org/783443
+Forwarded: not-needed
+Author: Shlomi Fish <shlomif at shlomifish.org>
+Last-Update: 2015-04-27
+Applied-Upstream: 2.0119
+
+--- a/LibXML.pm
++++ b/LibXML.pm
+@@ -396,8 +396,11 @@ sub _clone {
+ line_numbers => $self->{XML_LIBXML_LINENUMBERS},
+ base_uri => $self->{XML_LIBXML_BASE_URI},
+ gdome => $self->{XML_LIBXML_GDOME},
+- set_parser_flags => $self->{XML_LIBXML_PARSER_OPTIONS},
+ });
++ # The parser options may contain some options that were zeroed from the
++ # defaults so set_parser_flags won't work here. We need to assign them
++ # explicitly.
++ $new->{XML_LIBXML_PARSER_OPTIONS} = $self->{XML_LIBXML_PARSER_OPTIONS};
+ $new->input_callbacks($self->input_callbacks());
+ return $new;
+ }
+--- a/t/43options.t
++++ b/t/43options.t
+@@ -3,7 +3,7 @@
+ use strict;
+ use warnings;
+
+-use Test::More tests => 289;
++use Test::More tests => 290;
+
+ use XML::LibXML;
+
+@@ -125,6 +125,45 @@ no_network
+ }
+
+ {
++ my $XML = <<'EOT';
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE title [ <!ELEMENT title ANY >
++<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
++<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
++<channel>
++ <title>XXE</title>
++ <link>example.com</link>
++ <description>XXE</description>
++ <item>
++ <title>&xxe;</title>
++ <link>example.com</link>
++ <description>XXE here</description>
++ </item>
++</channel>
++</rss>
++EOT
++
++ my $sys_line = <<'EOT';
++<!ENTITY xxe SYSTEM "file:///etc/passwd"
++EOT
++
++ chomp ($sys_line);
++
++ my $parser = XML::LibXML->new(
++ expand_entities => 0,
++ load_ext_dtd => 0,
++ no_network => 1,
++ expand_xinclude => 0,
++ );
++ my $XML_DOC = $parser->load_xml( string => $XML, );
++
++ # TEST
++ like (scalar($XML_DOC->toString()), qr/\Q$sys_line\E/,
++ "expand_entities is preserved after _clone()/etc."
++ );
++}
++
++{
+ my $p = XML::LibXML->new(map { $_=>1 } @all);
+ for my $opt (@all) {
+ # TEST*$all
diff --git a/debian/patches/series b/debian/patches/series
index 872b300..6176cb8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
fail-build-no-libxml2.patch
+Preserve-unset-options-after-a-_clone-call.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libxml-libxml-perl.git
More information about the Pkg-perl-cvs-commits
mailing list