This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository libyaml-libyaml-perl.
commit 5486573432b5c4610bb0268ec480ccef7fc1bbe6 Author: Dominique Dumont <[email protected]> Date: Mon Jan 8 18:51:08 2018 +0100 remove add-safe-load patch --- debian/patches/add-safe-load | 208 ------------------------------------------- 1 file changed, 208 deletions(-) diff --git a/debian/patches/add-safe-load b/debian/patches/add-safe-load deleted file mode 100644 index 6eb53bf..0000000 --- a/debian/patches/add-safe-load +++ /dev/null @@ -1,208 +0,0 @@ -Description: Add SafeLoad method - Patch YAML::XS to provide a SafeLoad method. This works like Load method except that tag like '! Foo::Bar' are ignored so no Perl class can be created. - . - Warning: upstream probably won't accept this patch. We should not ship it. -Bug: https://github.com/ingydotnet/yaml-libyaml-pm/issues/45 -Bug-Debian: https://bugs.debian.org/862373 -Forwarded: https://github.com/ingydotnet/yaml-libyaml-pm/issues/45#issuecomment-343676592 -Author: Dominique Dumont <[email protected]> ---- a/LibYAML/perl_libyaml.c -+++ b/LibYAML/perl_libyaml.c -@@ -116,7 +116,7 @@ - * It takes a yaml stream and turns it into 0 or more Perl objects. - */ - void --Load(SV *yaml_sv) -+Load(SV *yaml_sv, int allow_bless) - { - dXCPT; - -@@ -140,6 +140,7 @@ - - yaml_parser_initialize(&loader.parser); - loader.document = 0; -+ loader.allow_bless = allow_bless; - yaml_parser_set_input_string( - &loader.parser, - yaml_str, -@@ -320,7 +321,7 @@ - /* Deal with possibly blessing the hash if the YAML tag has a class */ - if (tag && strEQ(tag, TAG_PERL_PREFIX "hash")) - tag = NULL; -- if (tag) { -+ if ( loader->allow_bless && tag) { - char *class; - char *prefix = TAG_PERL_PREFIX "hash:"; - if (*tag == '!') { -@@ -354,7 +355,7 @@ - } - if (tag && strEQ(tag, TAG_PERL_PREFIX "array")) - tag = NULL; -- if (tag) { -+ if ( loader->allow_bless && tag) { - char *class; - char *prefix = TAG_PERL_PREFIX "array:"; - if (*tag == '!') -@@ -448,7 +449,7 @@ - SPAGAIN; - regexp = newSVsv(POPs); - -- if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) { -+ if ( loader->allow_bless && strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) { - char *class = tag + strlen(prefix); - sv_bless(regexp, gv_stashpv(class, TRUE)); - } ---- a/LibYAML/perl_libyaml.h -+++ b/LibYAML/perl_libyaml.h -@@ -30,6 +30,7 @@ - HV *anchors; - int load_code; - int document; -+ int allow_bless; - } perl_yaml_loader_t; - - typedef struct { -@@ -60,7 +61,7 @@ - Dump(SV *, ...); - - void --Load(SV *); -+Load(SV *, int); - - SV * - load_node(perl_yaml_loader_t *); ---- a/lib/YAML/XS.pm -+++ b/lib/YAML/XS.pm -@@ -5,10 +5,10 @@ - - use base 'Exporter'; - --@YAML::XS::EXPORT = qw(Load Dump); -+@YAML::XS::EXPORT = qw(Load Dump SafeLoad); - @YAML::XS::EXPORT_OK = qw(LoadFile DumpFile); - %YAML::XS::EXPORT_TAGS = ( -- all => [qw(Dump Load LoadFile DumpFile)], -+ all => [qw(Dump Load SafeLoad LoadFile DumpFile)], - ); - # $YAML::XS::UseCode = 0; - # $YAML::XS::DumpCode = 0; -@@ -16,7 +16,7 @@ - - $YAML::XS::QuoteNumericStrings = 1; - --use YAML::XS::LibYAML qw(Load Dump); -+use YAML::XS::LibYAML qw(Load Dump SafeLoad); - use Scalar::Util qw/ openhandle /; - - sub DumpFile { ---- a/LibYAML/LibYAML.xs -+++ b/LibYAML/LibYAML.xs -@@ -13,7 +13,15 @@ - SV *yaml_sv - PPCODE: - PL_markstack_ptr++; -- Load(yaml_sv); -+ Load(yaml_sv, 1); -+ return; -+ -+void -+SafeLoad (yaml_sv) -+ SV *yaml_sv -+ PPCODE: -+ PL_markstack_ptr++; -+ Load(yaml_sv, 0); - return; - - void ---- a/LibYAML/lib/YAML/XS/LibYAML.pm -+++ b/LibYAML/lib/YAML/XS/LibYAML.pm -@@ -7,7 +7,7 @@ - XSLoader::load 'YAML::XS::LibYAML'; - use base 'Exporter'; - --our @EXPORT_OK = qw(Load Dump); -+our @EXPORT_OK = qw(Load Dump SafeLoad); - - 1; - ---- a/t/TestYAMLTests.pm -+++ b/t/TestYAMLTests.pm -@@ -1,7 +1,7 @@ - package t::TestYAMLTests; - use lib 'inc'; - use Test::Base -Base; --@t::TestYAMLTests::EXPORT = qw(Load Dump n2y y2n nyny get_block_by_name); -+@t::TestYAMLTests::EXPORT = qw(SafeLoad Load Dump n2y y2n nyny get_block_by_name); - - sub load_config() { - my $config_file = shift; -@@ -93,6 +93,10 @@ - no strict 'refs'; - &{$yaml_module . "::Load"}(@_); - } -+sub SafeLoad() { -+ no strict 'refs'; -+ &{$yaml_module . "::SafeLoad"}(@_); -+} - sub Dump() { - no strict 'refs'; - &{$yaml_module . "::Dump"}(@_); -@@ -108,6 +112,10 @@ - t::TestYAMLTests::Load(@_); - } - -+sub load_safe_yaml { -+ t::TestYAMLTests::SafeLoad(@_); -+} -+ - sub dump_yaml { - t::TestYAMLTests::Load(@_); - } ---- a/t/blessed.t -+++ b/t/blessed.t -@@ -1,16 +1,19 @@ --use t::TestYAMLTests tests => 10; -+use t::TestYAMLTests tests => 12; - - filters { - perl => 'eval', - yaml => 'load_yaml', -+ for_safe_yaml => 'load_safe_yaml', - }; - my $test = get_block_by_name("Blessed Hashes and Arrays"); - - my $hash = $test->perl; - my $hash2 = $test->yaml; -+my $hash_safe = $test->for_safe_yaml; - - # is_deeply is broken and doesn't check blessings - is_deeply $hash2, $hash, "Load " . $test->name; -+is_deeply $hash_safe, $hash, "SafeLoad " . $test->name; - - is ref($hash2->{foo}), 'Foo::Bar', - "Object at 'foo' is blessed 'Foo::Bar'"; -@@ -21,6 +24,9 @@ - is ref($hash2->{two}), 'BigList', - "Object at 'two' is blessed 'BigList'"; - -+is ref($hash_safe->{bar}), 'HASH', -+ "Object at 'foo' is NOT blessed with SafeLoad"; -+ - my $yaml = Dump($hash2); - - is $yaml, $test->yaml_dump, "Dumping " . $test->name . " works"; -@@ -49,6 +55,14 @@ - foo: !!perl/hash:Foo::Bar {} - bar: !!perl/hash:Foo::Bar - bass: bawl -+one: !!perl/array:BigList [] -+two: !!perl/array:BigList -+- lola -+- alol -++++ for_safe_yaml -+foo: !!perl/hash:Foo::Bar {} -+bar: !!perl/hash:Foo::Bar -+ bass: bawl - one: !!perl/array:BigList [] - two: !!perl/array:BigList - - lola -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libyaml-libyaml-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
