Hello community, here is the log from the commit of package perl-Convert-ASN1 for openSUSE:Factory checked in at 2015-04-15 16:27:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Convert-ASN1 (Old) and /work/SRC/openSUSE:Factory/.perl-Convert-ASN1.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Convert-ASN1" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Convert-ASN1/perl-Convert-ASN1.changes 2013-06-06 15:10:41.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Convert-ASN1.new/perl-Convert-ASN1.changes 2015-04-15 16:27:49.000000000 +0200 @@ -1,0 +2,13 @@ +Wed Apr 15 11:25:50 UTC 2015 - [email protected] + +- updated to 0.27 + see /usr/share/doc/packages/perl-Convert-ASN1/ChangeLog + + 0.27 -- Wed Jun 25 13:47:28 CDT 2014 + * Avoid recursion when encountering an invalid tag and length + * Avoid negative repetition counts (5.22 compatibility) [Alex Vandiver] + * Use pack/unpack instead of chr/org to avoid encoding issues + +- obsolete Convert-ASN1-0.22-path.diff + +------------------------------------------------------------------- Old: ---- Convert-ASN1-0.22-path.diff Convert-ASN1-0.26.tar.gz New: ---- Convert-ASN1-0.27.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Convert-ASN1.spec ++++++ --- /var/tmp/diff_new_pack.eLbrUI/_old 2015-04-15 16:27:49.000000000 +0200 +++ /var/tmp/diff_new_pack.eLbrUI/_new 2015-04-15 16:27:49.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Convert-ASN1 # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,28 +17,22 @@ Name: perl-Convert-ASN1 -Version: 0.26 +Version: 0.27 Release: 0 %define cpan_name Convert-ASN1 -Summary: ASN.1 Encode/Decode library +Summary: Asn.1 Encode/Decode Library License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Convert-ASN1/ Source: http://www.cpan.org/authors/id/G/GB/GBARR/%{cpan_name}-%{version}.tar.gz -Patch0: %{cpan_name}-0.22-path.diff -Patch1: %{cpan_name}-0.22-test.diff +Source1: cpanspec.yml +Patch0: Convert-ASN1-0.22-test.diff BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Math::BigInt) >= 1.997 BuildRequires: perl(Test::More) >= 0.90 -#BuildRequires: perl(Convert::ASN1) -#BuildRequires: perl(Convert::ASN1::Debug) -#BuildRequires: perl(Convert::ASN1::_decode) -#BuildRequires: perl(Convert::ASN1::_encode) -#BuildRequires: perl(Convert::ASN1::IO) -#BuildRequires: perl(Convert::ASN1::parser) %{perl_requires} %description @@ -48,7 +42,6 @@ %prep %setup -q -n %{cpan_name}-%{version} %patch0 -%patch1 %build %{__perl} Makefile.PL INSTALLDIRS=vendor ++++++ Convert-ASN1-0.26.tar.gz -> Convert-ASN1-0.27.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/ChangeLog new/Convert-ASN1-0.27/ChangeLog --- old/Convert-ASN1-0.26/ChangeLog 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/ChangeLog 2014-06-25 20:47:34.000000000 +0200 @@ -1,3 +1,8 @@ +0.27 -- Wed Jun 25 13:47:28 CDT 2014 + * Avoid recursion when encountering an invalid tag and length + * Avoid negative repetition counts (5.22 compatibility) [Alex Vandiver] + * Use pack/unpack instead of chr/org to avoid encoding issues + 0.26 -- Sat Jun 09 13:30:16 CDT 2012 * Avoid Modification of a read-only value attempted errors * dump Data::Dumper strings when rtest fails diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/LICENSE new/Convert-ASN1-0.27/LICENSE --- old/Convert-ASN1-0.26/LICENSE 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/LICENSE 2014-06-25 20:47:34.000000000 +0200 @@ -1,4 +1,4 @@ -This software is copyright (c) 2012 by Graham Barr. +This software is copyright (c) 2014 by Graham Barr. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2012 by Graham Barr. +This software is Copyright (c) 2014 by Graham Barr. This is free software, licensed under: @@ -272,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2012 by Graham Barr. +This software is Copyright (c) 2014 by Graham Barr. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/MANIFEST new/Convert-ASN1-0.27/MANIFEST --- old/Convert-ASN1-0.26/MANIFEST 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/MANIFEST 2014-06-25 20:47:34.000000000 +0200 @@ -41,6 +41,7 @@ t/16extset.t t/17extchoice.t t/18tagdefault.t +t/99misc.t t/aj.cer t/aj2.cer t/allianz_root.cer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/META.json new/Convert-ASN1-0.27/META.json --- old/Convert-ASN1-0.26/META.json 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/META.json 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ "Graham Barr <[email protected]>" ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 4.300015, CPAN::Meta::Converter version 2.120921", + "generated_by" : "Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], @@ -44,6 +44,6 @@ "web" : "https://github.com/gbarr/perl-Convert-ASN1" } }, - "version" : "0.26" + "version" : "0.27" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/META.yml new/Convert-ASN1-0.27/META.yml --- old/Convert-ASN1-0.26/META.yml 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/META.yml 2014-06-25 20:47:34.000000000 +0200 @@ -8,7 +8,7 @@ configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 -generated_by: 'Dist::Zilla version 4.300015, CPAN::Meta::Converter version 2.120921' +generated_by: 'Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -22,4 +22,4 @@ resources: bugtracker: https://github.com/gbarr/perl-Convert-ASN1/issues repository: git://github.com/gbarr/perl-Convert-ASN1.git -version: 0.26 +version: 0.27 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/Makefile.PL new/Convert-ASN1-0.27/Makefile.PL --- old/Convert-ASN1-0.26/Makefile.PL 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/Makefile.PL 2014-06-25 20:47:34.000000000 +0200 @@ -23,7 +23,7 @@ "LICENSE" => "perl", "NAME" => "Convert::ASN1", "PREREQ_PM" => {}, - "VERSION" => "0.26", + "VERSION" => "0.27", "test" => { "TESTS" => "t/*.t" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/SIGNATURE new/Convert-ASN1-0.27/SIGNATURE --- old/Convert-ASN1-0.26/SIGNATURE 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/SIGNATURE 2014-06-25 20:47:34.000000000 +0200 @@ -1,5 +1,5 @@ This file contains message digests of all files listed in MANIFEST, -signed via the Module::Signature module, version 0.64. +signed via the Module::Signature module, version 0.70. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: @@ -14,27 +14,27 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 d8cc16795b04958d9fb14d778cce8f33b3906fdf ChangeLog -SHA1 0433bbff935245e9752d7633fe7caea3ef6c8187 LICENSE -SHA1 c13624a3ed1f79098255fd6ae6c8b19f047b3fe1 MANIFEST -SHA1 00819c9c32d0342403226bfd2b972b9c6a06ab12 META.json -SHA1 e7739aac83f786a9ed0c7652a340736eb7b43df8 META.yml -SHA1 e04da0ebc1a22836315bb338a361f77c768acc49 Makefile.PL +SHA1 95a797cc83966e4549083166706faede0033c02e ChangeLog +SHA1 2bf572da781c106f615754e11dd1523480f4a25b LICENSE +SHA1 84af6f43ee677a8517171da76c222c5663b2cfac MANIFEST +SHA1 1383bc711147d4e8b27cf33e0a71598867763d21 META.json +SHA1 be1839de63caa8458fa97aaf0ec7ef8ff55cd457 META.yml +SHA1 110ea3a472d2edd79860232cdbe23e2e2b9d7dbd Makefile.PL SHA1 34baa595be366d4d07d3719e0ffedec7598dd5cb OldChanges SHA1 8505ff40c7ae961f694d42fd0e5b3a71b3b43d3c README.md SHA1 96177abd8d9a3cba4927b4c1dd9e3bb8b5ec8d10 dist.ini SHA1 905b1f3ec388b43432882585f70627d81a2d64eb examples/ldap SHA1 731cdbffc8b4275c20f194422584b6278a728fa0 examples/ldap-search SHA1 e9c1b61ecaf01da809b2311e48e779d7855f2703 examples/x509decode -SHA1 920dd8b717133163d660b2f3f50b3a13f3a35d5b lib/Convert/ASN1.pm -SHA1 0ef40b5e868189a731383a02cbdca2277b192ae4 lib/Convert/ASN1.pod -SHA1 62e208ac8cbbab5ef8bf9b60c280baf26da25799 lib/Convert/ASN1/Debug.pm -SHA1 7edb4878201e763685d2a18607d203e4db3a46de lib/Convert/ASN1/IO.pm -SHA1 d24aac21af4f3dc4d50fbf3d78ab4901d12b75cc lib/Convert/ASN1/_decode.pm -SHA1 dc269fde8f2b589ac1848846fc6aa902ec9addaa lib/Convert/ASN1/_encode.pm -SHA1 8e0c2240511d1858a32fad88b4451edfb6cd75b3 lib/Convert/ASN1/parser.pm +SHA1 d6b43486eeb24bbf3e95d9fdd7f68cc4467e39de lib/Convert/ASN1.pm +SHA1 749e448b66badf820f0330a6e4b4a98457411fa5 lib/Convert/ASN1.pod +SHA1 1a485981089f46207e4cd2376cc770e3980abb2e lib/Convert/ASN1/Debug.pm +SHA1 dd559f8259616a66998df6c31d5d05d3b8efd136 lib/Convert/ASN1/IO.pm +SHA1 702f64aee094f179bed1cc90e16d4b5e22284c11 lib/Convert/ASN1/_decode.pm +SHA1 440b181e7343d7f0f37bdac68ecef3a3980c97a4 lib/Convert/ASN1/_encode.pm +SHA1 a90d553c0508b7c662d21d29234925528909aff8 lib/Convert/ASN1/parser.pm SHA1 025eb26d2828ae9153d5b5e50eb2cafed8d91ec0 mkparse -SHA1 f08e71dc2dcc80c129e91b856b5ec6845cf3f034 parser.y +SHA1 49ea4886da04ec358bf75114917784ffe01ef9ca parser.y SHA1 47ea660ec5b7d891511376631ca8bc703152de52 t/00prim.t SHA1 be18a157f0146d6565ee8d408953fc4fb6b5a277 t/01tag.t SHA1 99d1ebf5730490b798bd72101a891098f274c106 t/02seq.t @@ -56,6 +56,7 @@ SHA1 204dcecb1793fc8347a58d54af27fd5fa87c3fd7 t/16extset.t SHA1 40041d7c6b861590d977f183801a5ee929a46801 t/17extchoice.t SHA1 a07dfd87a3d672f546500b302526710245ee611a t/18tagdefault.t +SHA1 fe78bbe85d225fd7030703537c9ae65157e69d81 t/99misc.t SHA1 4478dba7f3c409d8cd4673022470301d7197eb74 t/aj.cer SHA1 b4dfb113e0d45ae9c5dce0311ec3c604d9913ba5 t/aj2.cer SHA1 a82a05d7a22a348abe1e01116ecaf118d22a67ff t/allianz_root.cer @@ -68,9 +69,19 @@ SHA1 273ee12457fdc4f90c55e82b56167f62f532e547 t/verisign.der SHA1 e908b8c53c098d96bb4499a56e1d5320173ccae9 t/x509.t -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.11 (Darwin) +Version: GnuPG v1 -iEYEARECAAYFAk/TljsACgkQR0BL4gbYw3QmrQCdFfFeF1Lj0mld1dDXIzPLkd5R -e5cAn1NPqkcxnP6DkkGHT6SBCjPH8VA/ -=oA9b +iQIcBAEBAgAGBQJTqxlCAAoJEF0awSLzqjNNWkAQAJhWThEq4+yfpDYAp7W6Fuil +FD7NRfC5GuiDzfh2AU1tyPrvVEWIQOVkKxlyTvsfyV4iwfhDIpFp378KhmaSFNoV ++xfjI7lPj5/N1QzHvHRzApU0myZpPFK0sftfkuDB/K8XM18c2Z69PKAFaNSdceVg +xAHJXxCZmlcp4fNPoMyrStqBJmJzPICIJmeWrh32gqgs29HOzOvzINELs54C0Jw3 +ZqxoeskBMcmICF+RsfQjCZ3bxpn+C873wPeXE7Yx3frBCL61JjphCCBRgEC8FfGf +rkZK+tmkQoiKiDNu5tK1JJ32m9odh1eazxuZpmfC2Nh5nHDzZnXog4PqFcqwlRZm +3gP3rMlmaWDurNBXOMH/uWygvSYh5XevygQPf1JrleVo1G1qXb28u1Bfgkh2PSQX +gnGp642Zkrd40r2Fo4+ckmnf4NBa/Ayu/qfUPdYTv28x26HoXmTJhQZcuVAXAUYi +w7ISFsK1sVXkERRfD4JoIXn4kkXKXVTesGsNzFSmmY1Dyve0CQBNuCv2qNF6+hv9 +X8fW1czVuDLElJw0y0uqXquR+NH7mWg55gwXAevhxbrHZRqmhgEUfs4JX0WVhyOM +zv06eq4hy43H61l+RCdtu7MSDucL5DeAbp2OgrStNqAG3NGFWf4PX/NirxX+3k7D +1EcaVqHSXp5uvWdtJdUt +=Tocd -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1/Debug.pm new/Convert-ASN1-0.27/lib/Convert/ASN1/Debug.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1/Debug.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1/Debug.pm 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ package Convert::ASN1; { - $Convert::ASN1::VERSION = '0.26'; + $Convert::ASN1::VERSION = '0.27'; } ## @@ -84,6 +84,7 @@ my $start = $pos; my($tb,$tag,$tnum) = asn_decode_tag2(substr($_[0],$pos,10)); + last unless defined $tb; $pos += $tb; my($lb,$len) = asn_decode_length(substr($_[0],$pos,10)); $pos += $lb; @@ -160,6 +161,7 @@ } $pos += $len; } + printf "Buffer contains %d extra bytes\n", $length - $pos if $pos < $length; select($ofh); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1/IO.pm new/Convert-ASN1-0.27/lib/Convert/ASN1/IO.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1/IO.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1/IO.pm 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ package Convert::ASN1; { - $Convert::ASN1::VERSION = '0.26'; + $Convert::ASN1::VERSION = '0.27'; } use strict; @@ -54,7 +54,7 @@ last MORE; } - if (ord(substr($buf,$pos+$tb,1)) == 0x80) { + if (unpack("C",substr($buf,$pos+$tb,1)) == 0x80) { # indefinite length, grrr! $depth++; $pos += $tb + 1; @@ -141,7 +141,7 @@ goto READ_ERR; } - my $tch = ord(substr($_[1],$pos++,1)); + my $tch = unpack("C",substr($_[1],$pos++,1)); # Tag may be multi-byte if(($tch & 0x1f) == 0x1f) { my $ch; @@ -151,7 +151,7 @@ $e = sysread($_[0],$_[1],$n,length $_[1]) or goto READ_ERR; } - $ch = ord(substr($_[1],$pos++,1)); + $ch = unpack("C",substr($_[1],$pos++,1)); } while($ch & 0x80); } @@ -162,7 +162,7 @@ goto READ_ERR; } - my $len = ord(substr($_[1],$pos++,1)); + my $len = unpack("C",substr($_[1],$pos++,1)); if($len & 0x80) { unless ($len &= 0x7f) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1/_decode.pm new/Convert-ASN1-0.27/lib/Convert/ASN1/_decode.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1/_decode.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1/_decode.pm 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ package Convert::ASN1; { - $Convert::ASN1::VERSION = '0.26'; + $Convert::ASN1::VERSION = '0.27'; } use strict; @@ -83,7 +83,7 @@ next OP; } - if ($tag eq ($op->[cTAG] | chr(ASN_CONSTRUCTOR)) + if ($tag eq ($op->[cTAG] | pack("C",ASN_CONSTRUCTOR)) and my $ctr = $ctr[$op->[cTYPE]]) { _decode( @@ -210,7 +210,7 @@ next OP; } - if ($tag eq ($cop->[cTAG] | chr(ASN_CONSTRUCTOR)) + if ($tag eq ($cop->[cTAG] | pack("C",ASN_CONSTRUCTOR)) and my $ctr = $ctr[$cop->[cTYPE]]) { my $nstash = $seqof @@ -265,7 +265,7 @@ # 0 1 2 3 4 5 6 # $optn, $op, $stash, $var, $buf, $pos, $len - $_[3] = ord(substr($_[4],$_[5],1)) ? 1 : 0; + $_[3] = unpack("C",substr($_[4],$_[5],1)) ? 1 : 0; 1; } @@ -275,9 +275,9 @@ # $optn, $op, $stash, $var, $buf, $pos, $len my $buf = substr($_[4],$_[5],$_[6]); - my $tmp = ord($buf) & 0x80 ? chr(255) : chr(0); + my $tmp = unpack("C",$buf) & 0x80 ? pack("C",255) : pack("C",0); if ($_[6] > 4) { - $_[3] = os2ip($tmp x (4-$_[6]) . $buf, $_[0]->{decode_bigint} || 'Math::BigInt'); + $_[3] = os2ip($buf, $_[0]->{decode_bigint} || 'Math::BigInt'); } else { # N unpacks an unsigned value $_[3] = unpack("l",pack("l",unpack("N", $tmp x (4-$_[6]) . $buf))); @@ -290,7 +290,7 @@ # 0 1 2 3 4 5 6 # $optn, $op, $stash, $var, $buf, $pos, $len - $_[3] = [ substr($_[4],$_[5]+1,$_[6]-1), ($_[6]-1)*8-ord(substr($_[4],$_[5],1)) ]; + $_[3] = [ substr($_[4],$_[5]+1,$_[6]-1), ($_[6]-1)*8-unpack("C",substr($_[4],$_[5],1)) ]; 1; } @@ -342,7 +342,7 @@ $_[3] = 0.0, return unless $_[6]; - my $first = ord(substr($_[4],$_[5],1)); + my $first = unpack("C",substr($_[4],$_[5],1)); if ($first & 0x80) { # A real number @@ -354,7 +354,7 @@ if($expLen == 3) { $estart++; - $expLen = ord(substr($_[4],$_[5]+1,1)); + $expLen = unpack("C",substr($_[4],$_[5]+1,1)); } else { $expLen++; @@ -465,7 +465,7 @@ $done = $idx; last SET_OP; } - if ($tag eq ($op->[cTAG] | chr(ASN_CONSTRUCTOR)) + if ($tag eq ($op->[cTAG] | pack("C",ASN_CONSTRUCTOR)) and my $ctr = $ctr[$op->[cTYPE]]) { _decode( @@ -505,7 +505,7 @@ $done = $idx; last SET_OP; } - if ($tag eq ($cop->[cTAG] | chr(ASN_CONSTRUCTOR)) + if ($tag eq ($cop->[cTAG] | pack("C",ASN_CONSTRUCTOR)) and my $ctr = $ctr[$cop->[cTYPE]]) { my $nstash = defined($var) ? ($stash->{$var}={}) : $stash; @@ -623,14 +623,17 @@ sub _decode_tl { my($pos,$end,$larr) = @_[1,2,3]; + return if $pos >= $end; + my $indef = 0; my $tag = substr($_[0], $pos++, 1); - if((ord($tag) & 0x1f) == 0x1f) { + if((unpack("C",$tag) & 0x1f) == 0x1f) { my $b; my $n=1; do { + return if $pos >= $end; $tag .= substr($_[0],$pos++,1); $b = ord substr($tag,-1); } while($b & 0x80); @@ -645,7 +648,8 @@ if ($len) { return if $pos+$len > $end ; - ($len,$pos) = (unpack("N", "\0" x (4 - $len) . substr($_[0],$pos,$len)), $pos+$len); + my $padding = $len < 4 ? "\0" x (4 - $len) : ""; + ($len,$pos) = (unpack("N", $padding . substr($_[0],$pos,$len)), $pos+$len); } else { unless (exists $larr->{$pos}) { @@ -682,7 +686,7 @@ my $tag = substr($_[0], $pos++, 1); - if((ord($tag) & 0x1f) == 0x1f) { + if((unpack("C",$tag) & 0x1f) == 0x1f) { my $b; do { $tag .= substr($_[0],$pos++,1); @@ -697,7 +701,8 @@ if ($len &= 0x7f) { return if $pos+$len > $end ; - $pos += $len + unpack("N", "\0" x (4 - $len) . substr($_[0],$pos,$len)); + my $padding = $len < 4 ? "\0" x (4 - $len) : ""; + $pos += $len + unpack("N", $padding . substr($_[0],$pos,$len)); } else { # reserve another list element diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1/_encode.pm new/Convert-ASN1-0.27/lib/Convert/ASN1/_encode.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1/_encode.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1/_encode.pm 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ package Convert::ASN1; { - $Convert::ASN1::VERSION = '0.26'; + $Convert::ASN1::VERSION = '0.27'; } use strict; @@ -92,7 +92,7 @@ my $os = i2osp($_[3], ref($_[3]) || $_[0]->{encode_bigint} || 'Math::BigInt'); my $len = length $os; my $msb = (vec($os, 0, 8) & 0x80) ? 0 : 255; - $len++, $os = chr($msb) . $os if $msb xor $_[3] > 0; + $len++, $os = pack("C",$msb) . $os if $msb xor $_[3] > 0; $_[4] .= asn_encode_length($len); $_[4] .= $os; } @@ -124,15 +124,15 @@ my $less = (8 - ($_[3]->[1] & 7)) & 7; my $len = ($_[3]->[1] + 7) >> 3; $_[4] .= asn_encode_length(1+$len); - $_[4] .= chr($less); + $_[4] .= pack("C",$less); $_[4] .= substr($$vref, 0, $len); if ($less && $len) { - substr($_[4],-1) &= chr((0xff << $less) & 0xff); + substr($_[4],-1) &= pack("C",(0xff << $less) & 0xff); } } else { $_[4] .= asn_encode_length(1+length $$vref); - $_[4] .= chr(0); + $_[4] .= pack("C",0); $_[4] .= $$vref; } } @@ -158,7 +158,7 @@ # 0 1 2 3 4 5 6 # $optn, $op, $stash, $var, $buf, $loop, $path - $_[4] .= chr(0); + $_[4] .= pack("C",0); } @@ -190,7 +190,7 @@ # Zero unless ($_[3]) { - $_[4] .= chr(0); + $_[4] .= pack("C",0); return; } @@ -211,7 +211,7 @@ if (exists $_[0]->{'encode_real'} && $_[0]->{'encode_real'} ne 'binary') { my $tmp = sprintf("%g",$_[3]); $_[4] .= asn_encode_length(1+length $tmp); - $_[4] .= chr(1); # NR1? + $_[4] .= pack("C",1); # NR1? $_[4] .= $tmp; return; } @@ -228,7 +228,7 @@ while($mantissa > 0.0) { ($mantissa, my $int) = POSIX::modf($mantissa * (1<<8)); - $eMant .= chr($int); + $eMant .= pack("C",$int); } $exponent -= 8 * length $eMant; @@ -245,7 +245,7 @@ } $_[4] .= asn_encode_length(1 + length($eMant) + length($eExp)); - $_[4] .= chr($first); + $_[4] .= pack("C",$first); $_[4] .= $eExp; $_[4] .= $eMant; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1/parser.pm new/Convert-ASN1-0.27/lib/Convert/ASN1/parser.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1/parser.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1/parser.pm 2014-06-25 20:47:34.000000000 +0200 @@ -6,7 +6,7 @@ package Convert::ASN1::parser; { - $Convert::ASN1::parser::VERSION = '0.26'; + $Convert::ASN1::parser::VERSION = '0.27'; } use strict; @@ -733,7 +733,7 @@ } $op->[cTAG] = defined($op->[cTAG]) ? asn_encode_tag($op->[cTAG]): $ref->[0][cTAG]; } - $op->[cTAG] |= chr(ASN_CONSTRUCTOR) + $op->[cTAG] |= pack("C",ASN_CONSTRUCTOR) if length $op->[cTAG] && ($op->[cTYPE] == opSET || $op->[cTYPE] == opEXPLICIT || $op->[cTYPE] == opSEQUENCE); if ($op->[cCHILD]) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1.pm new/Convert-ASN1-0.27/lib/Convert/ASN1.pm --- old/Convert-ASN1-0.26/lib/Convert/ASN1.pm 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1.pm 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ package Convert::ASN1; { - $Convert::ASN1::VERSION = '0.26'; + $Convert::ASN1::VERSION = '0.27'; } use 5.004; @@ -237,7 +237,7 @@ ? pack("V",$_[0]) : substr(pack("V",$_[0]),0,3) : pack("v", $_[0]) - : chr($_[0]); + : pack("C",$_[0]); } @@ -302,7 +302,7 @@ sub asn_decode_length { return unless length $_[0]; - my $len = ord substr($_[0],0,1); + my $len = unpack("C",$_[0]); if($len & 0x80) { $len &= 0x7f or return (1,-1); @@ -318,14 +318,14 @@ sub asn_decode_tag { return unless length $_[0]; - my $tag = ord $_[0]; + my $tag = unpack("C", $_[0]); my $n = 1; if(($tag & 0x1f) == 0x1f) { my $b; do { return if $n >= length $_[0]; - $b = ord substr($_[0],$n,1); + $b = unpack("C",substr($_[0],$n,1)); $tag |= $b << (8 * $n++); } while($b & 0x80); } @@ -336,7 +336,7 @@ sub asn_decode_tag2 { return unless length $_[0]; - my $tag = ord $_[0]; + my $tag = unpack("C",$_[0]); my $num = $tag & 0x1f; my $len = 1; @@ -345,7 +345,7 @@ my $b; do { return if $len >= length $_[0]; - $b = ord substr($_[0],$len++,1); + $b = unpack("C",substr($_[0],$len++,1)); $num = ($num << 7) + ($b & 0x7f); } while($b & 0x80); } @@ -382,9 +382,9 @@ while($num != 0) { my $r = $num % $base; $num = ($num-$r) / $base; - $result .= chr($r); + $result .= pack("C",$r); } - $result ^= chr(255) x length($result) if $neg; + $result ^= pack("C",255) x length($result) if $neg; return scalar reverse $result; } @@ -395,8 +395,8 @@ eval "require $biclass"; my $base = $biclass->new(256); my $result = $biclass->new(0); - my $neg = ord($os) >= 0x80 - and $os ^= chr(255) x length($os); + my $neg = unpack("C",$os) >= 0x80 + and $os ^= pack("C",255) x length($os); for (unpack("C*",$os)) { $result = ($result * $base) + $_; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/lib/Convert/ASN1.pod new/Convert-ASN1-0.27/lib/Convert/ASN1.pod --- old/Convert-ASN1-0.26/lib/Convert/ASN1.pod 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/lib/Convert/ASN1.pod 2014-06-25 20:47:34.000000000 +0200 @@ -4,7 +4,7 @@ =head1 VERSION -version 0.26 +version 0.27 =head1 SYNOPSYS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/parser.y new/Convert-ASN1-0.27/parser.y --- old/Convert-ASN1-0.26/parser.y 2012-06-09 20:30:22.000000000 +0200 +++ new/Convert-ASN1-0.27/parser.y 2014-06-25 20:47:34.000000000 +0200 @@ -396,7 +396,7 @@ } $op->[cTAG] = defined($op->[cTAG]) ? asn_encode_tag($op->[cTAG]): $ref->[0][cTAG]; } - $op->[cTAG] |= chr(ASN_CONSTRUCTOR) + $op->[cTAG] |= pack("C",ASN_CONSTRUCTOR) if length $op->[cTAG] && ($op->[cTYPE] == opSET || $op->[cTYPE] == opEXPLICIT || $op->[cTYPE] == opSEQUENCE); if ($op->[cCHILD]) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Convert-ASN1-0.26/t/99misc.t new/Convert-ASN1-0.27/t/99misc.t --- old/Convert-ASN1-0.26/t/99misc.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Convert-ASN1-0.27/t/99misc.t 2014-06-25 20:47:34.000000000 +0200 @@ -0,0 +1,60 @@ +#!/usr/local/bin/perl + +# +# Misc tests from github reported issues +# + +use Convert::ASN1; +BEGIN { require 't/funcs.pl' } + +print "1..2\n"; + +{ # github issue 8 + + my $hexdata = "30 53 30 51 30 4f 30 4d 30 4b 30 09 06 05 2b 0e + 03 02 1a 05 00 04 14 a0 72 0e a0 6a 7c 62 02 54 + f2 a8 f5 9d d2 7b a4 f3 b7 2f a4 04 14 b0 b0 4a + fd 1c 75 28 f8 1c 61 aa 13 f6 fa c1 90 3d 6b 16 + a3 02 12 11 21 bc 57 28 6f 30 08 db 49 63 f6 ae + 89 3a de f6 d1 ff e0"; + $hexdata =~ s/ //g; + $hexdata =~ s/\n//g; + +# parse ASN.1 descriptions + my $asn = Convert::ASN1->new; + $asn->prepare(<<ASN1) or die "prepare: ", $asn->error; + OCSPRequest ::= SEQUENCE { + tbsRequest TBSRequest, + optionalSignature [0] EXPLICIT ANY OPTIONAL } + + TBSRequest ::= SEQUENCE { + version [0] EXPLICIT INTEGER OPTIONAL, + requestorName [1] EXPLICIT ANY OPTIONAL, + requestList SEQUENCE OF Request, + requestExtensions [2] EXPLICIT ANY OPTIONAL } + + Request ::= SEQUENCE { + reqCert CertID, + singleRequestExtensions [0] EXPLICIT ANY OPTIONAL } + + CertID ::= SEQUENCE { + hashAlgorithm ANY, + issuerNameHash OCTET STRING, -- Hash of Issuer's DN + issuerKeyHash OCTET STRING, -- Hash of Issuers public key + serialNumber INTEGER } +ASN1 + + my $asn_ocspreq = $asn->find('OCSPRequest'); + + my $OCSPREQDER = pack("H*", $hexdata); + + my $ocspreq = $asn_ocspreq->decode($OCSPREQDER); + my $err = $asn_ocspreq->error; + $err =~ s/ at .*line \d.*//s if $err; + stest 1, "decode error 85 87", $err; + + btest 2, !!$asn_ocspreq->decode(substr($OCSPREQDER, 0, -2)); + +} + + ++++++ cpanspec.yml ++++++ --- patches: Convert-ASN1-0.22-test.diff:
