Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-Convert-ASN1 for 
openSUSE:Factory checked in at 2026-12-01 16:57:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Convert-ASN1 (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Convert-ASN1.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Convert-ASN1"

Tue Dec  1 16:57:59 2026 rev:35 rq:1400978 version:0.370.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Convert-ASN1/perl-Convert-ASN1.changes      
2026-11-19 16:54:18.495731192 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Convert-ASN1.new.1340718/perl-Convert-ASN1.changes
 2026-12-01 16:58:14.084261857 +0100
@@ -1,0 +2,31 @@
+Fri Nov 20 14:01:18 UTC 2026 - Tina Müller <[email protected]>
+
+- updated to 0.370.0 (0.37)
+   see /usr/share/doc/packages/perl-Convert-ASN1/ChangeLog
+
+  0.37 -- Thu Nov 19 18:30:00 AST 2026
+  Security Fixes
+    * CVE-2026-126540: cap INTEGER/ENUMERATED decode size to prevent quadratic 
cost bsc#1291271
+    * CVE-2026-126568: fix asn_recv OOM on truncated header or huge declared 
length bsc#1291272
+    * CVE-2026-126576: bounds-check REAL exponent length; fix long-form 
mantissa size bsc#1291273
+    * CVE-2026-126682: cap INTEGER/ENUMERATED encode size to prevent quadratic 
cost bsc#1291275
+    * CVE-2026-126819: fix zero-length BIT STRING reading past end of buffer 
bsc#1291276
+    * CVE-2026-126956: add configurable decode depth limit to prevent stack 
exhaustion bsc#1291277
+    * CVE-2026-131868: prevent huge allocations in asn_read and asn_get 
bsc#1291278
+    * CVE-2026-131877: limit OBJECT IDENTIFIER arc size to prevent quadratic 
cost bsc#1291279
+  Bug Fixes
+    * Discard invalid datagrams so SOCK_DGRAM sockets don't wedge
+  Incompatible Changes
+    * INTEGER/ENUMERATED values over 1025 bytes (larger than an RSA-8192
+      modulus) are now rejected on decode and encode by default. Raise or
+      disable the limit with configure(decode => { max_int_len => N }) and
+      configure(encode => { max_int_len => N }); 0 means no limit.
+    * Structures nested more than 99 levels deep are now rejected on decode
+      by default. Raise or disable the limit with
+      configure(decode => { max_depth => N }); 0 means no limit.
+    * OBJECT IDENTIFIER and RELATIVE-OID arcs over 32 bytes (224 bits) are
+      now rejected on decode and encode by default. Raise or disable the
+      limit with configure(decode => { max_oid_arc_len => N }) and
+      configure(encode => { max_oid_arc_len => N }); 0 means no limit.
+
+-------------------------------------------------------------------

Old:
----
  Convert-ASN1-0.36.tar.gz

New:
----
  Convert-ASN1-0.37.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Convert-ASN1.spec ++++++
--- /var/tmp/diff_new_pack.Co8gxK/_old  2026-12-01 16:58:14.993299847 +0100
+++ /var/tmp/diff_new_pack.Co8gxK/_new  2026-12-01 16:58:14.995299931 +0100
@@ -18,10 +18,10 @@
 
 %define cpan_name Convert-ASN1
 Name:           perl-Convert-ASN1
-Version:        0.360.0
+Version:        0.370.0
 Release:        0
-# 0.36 -> normalize -> 0.360.0
-%define cpan_version 0.36
+# 0.37 -> normalize -> 0.370.0
+%define cpan_version 0.37
 License:        Artistic-1.0 OR GPL-1.0-or-later
 Summary:        Convert between perl data structures and ASN.1 encoded packets
 URL:            https://metacpan.org/release/%{cpan_name}

++++++ Convert-ASN1-0.36.tar.gz -> Convert-ASN1-0.37.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/ChangeLog 
new/Convert-ASN1-0.37/ChangeLog
--- old/Convert-ASN1-0.36/ChangeLog     2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/ChangeLog     2026-11-19 23:30:01.000000000 +0100
@@ -1,3 +1,34 @@
+0.37 -- Thu Nov 19 18:30:00 AST 2026
+
+Security Fixes
+
+  * CVE-2026-126540: cap INTEGER/ENUMERATED decode size to prevent quadratic 
cost
+  * CVE-2026-126568: fix asn_recv OOM on truncated header or huge declared 
length
+  * CVE-2026-126576: bounds-check REAL exponent length; fix long-form mantissa 
size
+  * CVE-2026-126682: cap INTEGER/ENUMERATED encode size to prevent quadratic 
cost
+  * CVE-2026-126819: fix zero-length BIT STRING reading past end of buffer
+  * CVE-2026-126956: add configurable decode depth limit to prevent stack 
exhaustion
+  * CVE-2026-131868: prevent huge allocations in asn_read and asn_get
+  * CVE-2026-131877: limit OBJECT IDENTIFIER arc size to prevent quadratic cost
+
+Bug Fixes
+
+  * Discard invalid datagrams so SOCK_DGRAM sockets don't wedge
+
+Incompatible Changes
+
+  * INTEGER/ENUMERATED values over 1025 bytes (larger than an RSA-8192
+    modulus) are now rejected on decode and encode by default. Raise or
+    disable the limit with configure(decode => { max_int_len => N }) and
+    configure(encode => { max_int_len => N }); 0 means no limit.
+  * Structures nested more than 99 levels deep are now rejected on decode
+    by default. Raise or disable the limit with
+    configure(decode => { max_depth => N }); 0 means no limit.
+  * OBJECT IDENTIFIER and RELATIVE-OID arcs over 32 bytes (224 bits) are
+    now rejected on decode and encode by default. Raise or disable the
+    limit with configure(decode => { max_oid_arc_len => N }) and
+    configure(encode => { max_oid_arc_len => N }); 0 means no limit.
+
 0.36 -- Mon Nov 09 18:44:55 AST 2026
 
 Release 0.35 as production release.  Includes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/MANIFEST 
new/Convert-ASN1-0.37/MANIFEST
--- old/Convert-ASN1-0.36/MANIFEST      2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/MANIFEST      2026-11-19 23:30:01.000000000 +0100
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.038
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.040
 ChangeLog
 LICENSE
 MANIFEST
@@ -44,7 +44,15 @@
 t/17extchoice.t
 t/18tagdefault.t
 t/19issue14.t
+t/20integer_max_len.t
 t/21x509time.t
+t/22asn_recv_truncated.t
+t/23dec_real.t
+t/24enc_integer_validate.t
+t/25dec_bitstring_zero_len.t
+t/26dec_depth_limit.t
+t/27asn_read_length.t
+t/28oid_arc_limit.t
 t/99misc.t
 t/aj.cer
 t/aj2.cer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/META.json 
new/Convert-ASN1-0.37/META.json
--- old/Convert-ASN1-0.36/META.json     2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/META.json     2026-11-19 23:30:01.000000000 +0100
@@ -4,7 +4,7 @@
       "Graham Barr <[email protected]>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 6.038, CPAN::Meta::Converter version 
2.150013",
+   "generated_by" : "Dist::Zilla version 6.040, CPAN::Meta::Converter version 
2.150010",
    "license" : [
       "perl_5"
    ],
@@ -49,12 +49,12 @@
          "web" : "https://github.com/gbarr/perl-Convert-ASN1";
       }
    },
-   "version" : "0.36",
-   "x_generated_by_perl" : "v5.42.0",
+   "version" : "0.37",
+   "x_generated_by_perl" : "v5.42.2",
    "x_maintainers" : [
       "Timothy Legge <[email protected]>"
    ],
-   "x_serialization_backend" : "Cpanel::JSON::XS version 4.40",
+   "x_serialization_backend" : "Cpanel::JSON::XS version 4.82",
    "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/META.yml 
new/Convert-ASN1-0.37/META.yml
--- old/Convert-ASN1-0.36/META.yml      2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/META.yml      2026-11-19 23:30:01.000000000 +0100
@@ -8,7 +8,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.038, CPAN::Meta::Converter version 
2.150013'
+generated_by: 'Dist::Zilla version 6.040, CPAN::Meta::Converter version 
2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,8 +24,8 @@
 resources:
   bugtracker: https://github.com/gbarr/perl-Convert-ASN1/issues
   repository: git://github.com/gbarr/perl-Convert-ASN1.git
-version: '0.36'
-x_generated_by_perl: v5.42.0
+version: '0.37'
+x_generated_by_perl: v5.42.2
 x_maintainers:
   - 'Timothy Legge <[email protected]>'
 x_serialization_backend: 'YAML::Tiny version 1.76'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/Makefile.PL 
new/Convert-ASN1-0.37/Makefile.PL
--- old/Convert-ASN1-0.36/Makefile.PL   2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/Makefile.PL   2026-11-19 23:30:01.000000000 +0100
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker 
v6.038
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker 
v6.040
 use strict;
 use warnings;
 
@@ -22,7 +22,7 @@
     "Math::BigInt" => "1.997",
     "Test::More" => "0.90"
   },
-  "VERSION" => "0.36",
+  "VERSION" => "0.37",
   "test" => {
     "TESTS" => "t/*.t"
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/cpanfile 
new/Convert-ASN1-0.37/cpanfile
--- old/Convert-ASN1-0.36/cpanfile      2026-11-09 23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/cpanfile      2026-11-19 23:30:01.000000000 +0100
@@ -1,4 +1,4 @@
-# This file is generated by Dist::Zilla::Plugin::CPANFile v6.038
+# This file is generated by Dist::Zilla::Plugin::CPANFile v6.040
 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file.
 
 requires "Time::Local" => "1.27";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1/Debug.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1/Debug.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1/Debug.pm     2026-11-09 
23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1/Debug.pm     2026-11-19 
23:30:01.000000000 +0100
@@ -3,7 +3,7 @@
 # modify it under the same terms as Perl itself.
 
 package Convert::ASN1;
-$Convert::ASN1::VERSION = '0.36';
+$Convert::ASN1::VERSION = '0.37';
 ##
 ## just for debug :-)
 ##
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1/IO.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1/IO.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1/IO.pm        2026-11-09 
23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1/IO.pm        2026-11-19 
23:30:01.000000000 +0100
@@ -3,7 +3,7 @@
 # modify it under the same terms as Perl itself.
 
 package Convert::ASN1;
-$Convert::ASN1::VERSION = '0.36';
+$Convert::ASN1::VERSION = '0.37';
 use strict;
 use Socket;
 
@@ -12,6 +12,10 @@
   eval { require bytes } and 'bytes'->import
 }
 
+# Largest single read, so the buffer perl allocates tracks the data
+# received and not the length an element declares
+my $MAX_READ = 65536;
+
 sub asn_recv { # $socket, $buffer, $flags
 
   my $peer;
@@ -46,7 +50,7 @@
 
     # If we can decode a tag and length we can determine the length
     ($tb,$tmp) = asn_decode_tag(substr($buf,$pos));
-    unless ($tb || $pos+$tb < length $buf) {
+    unless ($tb && ($pos+$tb < length $buf)) {
       next MORE if $n == length $buf;
       last MORE;
     }
@@ -70,21 +74,40 @@
        last MORE;
       }
     }
+    else {
+      next MORE if $n == length $buf;
+      last MORE;
+    }
   }
 
   if (defined $peer) {
+    my $type = getsockopt($_[0], SOL_SOCKET, SO_TYPE);
+    my $discard = defined $type && unpack('i', $type) == SOCK_DGRAM
+                  && !($_[2] & MSG_PEEK);
+
     if ($len > length $buf) {
-      # Check we can read the whole element
-      goto error
-       unless defined($peer = recv($_[0],$buf,$len,MSG_PEEK));
+      # Check we can read the whole element. Peek in doubling steps so the
+      # buffer perl allocates is bounded by the data available, not by the
+      # declared length
+      my $ask = length($buf) || 64;
+      while ($len > length $buf) {
+        $ask *= 2;
+        $ask = $len if $ask > $len;
+        goto error
+          unless defined($peer = recv($_[0],$buf,$ask,MSG_PEEK));
+        last if length($buf) < $ask;
+      }
 
       if ($len > length $buf) {
-       # Cannot get whole element
+       # Cannot get whole element; discard the datagram so it doesn't wedge 
the queue
+       recv($_[0], my $junk, length $buf, 0) if $discard;
        $_[1]='';
        return $peer;
       }
     }
     elsif ($len == 0) {
+      # Discard the datagram so it doesn't wedge the queue
+      recv($_[0], my $junk, length($buf) || 1, 0) if $discard;
       $_[1] = '';
       return $peer;
     }
@@ -134,7 +157,7 @@
     $need = ($pos + ($depth * 2)) || 2;
 
     while(($n = $need - length $_[1]) > 0) {
-      $e = sysread($_[0],$_[1],$n,length $_[1]) or
+      $e = sysread($_[0],$_[1],($n > $MAX_READ ? $MAX_READ : $n),length $_[1]) 
or
        goto READ_ERR;
     }
 
@@ -145,7 +168,7 @@
       do {
         $need++;
        while(($n = $need - length $_[1]) > 0) {
-         $e = sysread($_[0],$_[1],$n,length $_[1]) or
+         $e = sysread($_[0],$_[1],($n > $MAX_READ ? $MAX_READ : $n),length 
$_[1]) or
              goto READ_ERR;
        }
        $ch = unpack("C",substr($_[1],$pos++,1));
@@ -155,7 +178,7 @@
     $need = $pos + 1;
 
     while(($n = $need - length $_[1]) > 0) {
-      $e = sysread($_[0],$_[1],$n,length $_[1]) or
+      $e = sysread($_[0],$_[1],($n > $MAX_READ ? $MAX_READ : $n),length $_[1]) 
or
          goto READ_ERR;
     }
 
@@ -169,7 +192,7 @@
       $need = $pos + $len;
 
       while(($n = $need - length $_[1]) > 0) {
-       $e = sysread($_[0],$_[1],$n,length $_[1]) or
+       $e = sysread($_[0],$_[1],($n > $MAX_READ ? $MAX_READ : $n),length 
$_[1]) or
            goto READ_ERR;
       }
 
@@ -189,7 +212,7 @@
   }
 
   while(($n = $pos - length $_[1]) > 0) {
-    $e = sysread($_[0],$_[1],$n,length $_[1]) or
+    $e = sysread($_[0],$_[1],($n > $MAX_READ ? $MAX_READ : $n),length $_[1]) or
       goto READ_ERR;
   }
 
@@ -234,6 +257,7 @@
     }
 
     my $get = $need > 1024 ? $need : 1024;
+    $get = $MAX_READ if $get > $MAX_READ;
 
     sysread($_[0], $href->{'asn_buffer'}, $get, length $href->{'asn_buffer'})
       or return undef;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1/_decode.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1/_decode.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1/_decode.pm   2026-11-09 
23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1/_decode.pm   2026-11-19 
23:30:01.000000000 +0100
@@ -3,7 +3,7 @@
 # modify it under the same terms as Perl itself.
 
 package Convert::ASN1;
-$Convert::ASN1::VERSION = '0.36';
+$Convert::ASN1::VERSION = '0.37';
 use strict;
 use warnings;
 
@@ -44,6 +44,13 @@
 
 sub _decode {
   my ($optn, $ops, $stash, $pos, $end, $seqof, $larr) = @_;
+
+  my $max_depth = exists $optn->{decode_max_depth} ? $optn->{decode_max_depth} 
: 99;
+  local $optn->{_decode_depth} = ($optn->{_decode_depth} || 0) + 1;
+  die "decode: max_depth must not be negative\n" if $max_depth < 0;
+  die "decode error (nesting depth limit exceeded)\n"
+      if $max_depth > 0 && $optn->{_decode_depth} > $max_depth;
+
   my $idx = 0;
 
   # we try not to copy the input buffer at any time
@@ -137,8 +144,16 @@
               $handler ||= 
$optn->{handlers}{$op->[cVAR]}{$stash->{$op->[cDEFINE]}};
             }
 
-           ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : 
$stash->{$var})
-             = $handler ? $handler->decode(substr($buf,$pos,$len)) : 
substr($buf,$pos,$len);
+           if ($handler) {
+             local $handler->{options}{_decode_depth} = $optn->{_decode_depth};
+             local $handler->{options}{decode_max_depth} = $max_depth
+                 unless exists $handler->{options}{decode_max_depth};
+             ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : 
$stash->{$var})
+               = $handler->decode(substr($buf,$pos,$len));
+           } else {
+             ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : 
$stash->{$var})
+               = substr($buf,$pos,$len);
+           }
 
            $pos += $len;
 
@@ -206,7 +221,11 @@
 
                  @{$nstash}{keys %tmp_stash} = values %tmp_stash;
 
-               } or next;
+               } or do {
+                 die $@ if $@ =~ /nesting depth limit exceeded/;
+                 next;
+               };
+
 
                $pos = $npos+$len+$indef;
 
@@ -281,7 +300,13 @@
   my $buf = substr($_[4],$_[5],$_[6]);
   my $tmp = unpack("C",$buf) & 0x80 ? pack("C",255) : pack("C",0);
   if ($_[6] > 4) {
-      $_[3] = os2ip($buf, $_[0]->{decode_bigint} || 'Math::BigInt');
+      my $max = ($_[0] && exists $_[0]->{decode_max_int_len})
+                  ? $_[0]->{decode_max_int_len}
+                  : 1025;
+      die "decode: max_int_len must not be negative\n" if $max < 0;
+      die "INTEGER too large (length $_[6] exceeds max_int_len $max)\n"
+          if $max && $_[6] > $max;
+      $_[3] = os2ip($buf, ($_[0] && $_[0]->{decode_bigint}) || 'Math::BigInt');
   } else {
       # N unpacks an unsigned value
       $_[3] = unpack("l",pack("l",unpack("N", $tmp x (4-$_[6]) . $buf)));
@@ -294,6 +319,11 @@
 # 0      1    2       3     4     5     6
 # $optn, $op, $stash, $var, $buf, $pos, $len
 
+  if ($_[6] < 1) {
+    $_[3] = ["", 0];
+    return 1;
+  }
+  die "BIT STRING decode error\n" if unpack("C", substr($_[4],$_[5],1)) > 7;
   $_[3] = [ substr($_[4],$_[5]+1,$_[6]-1), 
($_[6]-1)*8-unpack("C",substr($_[4],$_[5],1)) ];
   1;
 }
@@ -321,6 +351,20 @@
 # 0      1    2       3     4     5     6
 # $optn, $op, $stash, $var, $buf, $pos, $len
 
+  # unpack "w" is quadratic in arc length, so bound each arc first
+  my $max = exists $_[0]->{decode_max_oid_arc_len}
+              ? $_[0]->{decode_max_oid_arc_len}
+              : 32;
+  die "decode: max_oid_arc_len must not be negative\n" if $max < 0;
+  if ($max) {
+    my $oid = substr($_[4],$_[5],$_[6]);
+    # every byte of an arc except its last has the high bit set
+    while ($oid =~ /[\x80-\xff]+/g) {
+      die "OBJECT IDENTIFIER decode error (arc too large)\n"
+          if $+[0] - $-[0] >= $max;
+    }
+  }
+
   my @data = unpack("w*",substr($_[4],$_[5],$_[6]));
   if ($_[1]->[cTYPE] == opOBJID and @data > 1) {
     if ($data[0] < 40) {
@@ -363,10 +407,15 @@
     else {
       $expLen++;
     }
+
+    my $overhead = $estart - $_[5];   # 1 short-form, 2 long-form
+    # an exponent over 4 bytes would become a bigint and make pow() run 
unbounded
+    die "REAL decode error\n" if $expLen > 4 || $expLen > $_[6] - $overhead;
+
     _dec_integer(undef, undef, undef, $exp, $_[4],$estart,$expLen);
 
     my $mant = 0.0;
-    for (reverse unpack("C*",substr($_[4],$estart+$expLen,$_[6]-1-$expLen))) {
+    for (reverse 
unpack("C*",substr($_[4],$estart+$expLen,$_[6]-$overhead-$expLen))) {
       $exp +=8, $mant = (($mant+$_) / 256) ;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1/_encode.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1/_encode.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1/_encode.pm   2026-11-09 
23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1/_encode.pm   2026-11-19 
23:30:01.000000000 +0100
@@ -3,9 +3,10 @@
 # modify it under the same terms as Perl itself.
 
 package Convert::ASN1;
-$Convert::ASN1::VERSION = '0.36';
+$Convert::ASN1::VERSION = '0.37';
 use strict;
 use warnings;
+use Scalar::Util 'blessed';
 
 BEGIN {
   unless (CHECK_UTF8) {
@@ -86,10 +87,34 @@
 # 0      1    2       3     4     5      6
 # $optn, $op, $stash, $var, $buf, $loop, $path
   if (abs($_[3]) >= 2**31) {
-    my $os = i2osp($_[3], ref($_[3]) || $_[0]->{encode_bigint} || 
'Math::BigInt');
+    my $biclass = $_[0]->{encode_bigint} || 'Math::BigInt';
+    my $digits;
+    if (blessed($_[3]) && $_[3]->isa($biclass)) {
+        ($digits = "$_[3]") =~ s/^[+-]//;
+        $digits = length $digits;
+    }
+    # size exponent-form strings before the bigint class expands them
+    elsif ("$_[3]" =~ /\A\s*[+-]?0*(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?\s*\z/
+           && (length($1) || (defined($2) && length($2)))) {
+        $digits = length($1) + ($3 || 0);
+    }
+    else {
+        die "INTEGER value is not an integer\n";
+    }
+    my $max = exists $_[0]->{encode_max_int_len}
+                ? $_[0]->{encode_max_int_len}
+                : 1025;
+    die "encode: max_int_len must not be negative\n" if $max < 0;
+    if ($max) {
+        # estimate byte size 0.415 = log(10) / log(256)
+        die "INTEGER too large\n" if int(($digits - 1) * 0.415) > $max + 1;
+    }
+    my $os = i2osp($_[3], blessed($_[3]) || $biclass);
     my $len = length $os;
     my $msb = (vec($os, 0, 8) & 0x80) ? 0 : 255;
     $len++, $os = pack("C",$msb) . $os if $msb xor $_[3] > 0;
+    die "INTEGER too large (length $len exceeds max_int_len $max)\n"
+        if $max && $len > $max;
     $_[4] .= asn_encode_length($len);
     $_[4] .= $os;
   }
@@ -165,6 +190,18 @@
 
   my @data = ($_[3] =~ /(\d+)/g);
 
+  # pack "w" is quadratic in arc length, so bound each arc first
+  my $max = exists $_[0]->{encode_max_oid_arc_len}
+              ? $_[0]->{encode_max_oid_arc_len}
+              : 32;
+  die "encode: max_oid_arc_len must not be negative\n" if $max < 0;
+  if ($max) {
+    # any arc of this many digits fits in $max bytes: 2.107 < 7 * log10(2)
+    my $digits = int($max * 2.107);
+    die "OBJECT IDENTIFIER arc too large\n"
+        if grep { length > $digits } @data;
+  }
+
   if ($_[1]->[cTYPE] == opOBJID) {
     if(@data < 2) {
       @data = (0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1/parser.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1/parser.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1/parser.pm    2026-11-09 
23:44:56.000000000 +0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1/parser.pm    2026-11-19 
23:30:01.000000000 +0100
@@ -5,7 +5,7 @@
 ;# modify it under the same terms as Perl itself.
 
 package Convert::ASN1::parser;
-$Convert::ASN1::parser::VERSION = '0.36';
+$Convert::ASN1::parser::VERSION = '0.37';
 use strict;
 use Convert::ASN1 qw(:all);
 use vars qw(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1.pm 
new/Convert-ASN1-0.37/lib/Convert/ASN1.pm
--- old/Convert-ASN1-0.36/lib/Convert/ASN1.pm   2026-11-09 23:44:56.000000000 
+0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1.pm   2026-11-19 23:30:01.000000000 
+0100
@@ -3,7 +3,7 @@
 # modify it under the same terms as Perl itself.
 
 package Convert::ASN1;
-$Convert::ASN1::VERSION = '0.36';
+$Convert::ASN1::VERSION = '0.37';
 use 5.004;
 use strict;
 use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS @opParts @opName $AUTOLOAD);
@@ -372,6 +372,8 @@
     my($num, $biclass) = @_;
     eval "use $biclass";
     $num = $biclass->new($num);
+    die "INTEGER value is not an integer\n"
+        if $num->can('is_nan') && $num->is_nan;
     my $neg = $num < 0
       and $num = abs($num+1);
     my $base = $biclass->new(256);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/lib/Convert/ASN1.pod 
new/Convert-ASN1-0.37/lib/Convert/ASN1.pod
--- old/Convert-ASN1-0.36/lib/Convert/ASN1.pod  2026-11-09 23:44:56.000000000 
+0100
+++ new/Convert-ASN1-0.37/lib/Convert/ASN1.pod  2026-11-19 23:30:01.000000000 
+0100
@@ -4,7 +4,7 @@
 
 =head1 VERSION
 
-version 0.36
+version 0.37
 
 =head1 SYNOPSIS
 
@@ -126,6 +126,34 @@
 integer class into which the objects will be blessed. The default
 is to use Math::BigInt
 
+=item max_int_len
+
+Maximum number of content bytes permitted for an INTEGER or ENUMERATED value
+greater than 32 bits before encoding is aborted with an error. Prevents
+application code that forwards an untrusted integer (such as a search
+size-limit or paged-results count) from triggering quadratic CPU usage in the
+bigint conversion loop. Defaults to C<1025> (enough for an RSA-8192 modulus,
+which requires a leading sign byte). Set to C<0> to disable the limit; negative
+values are rejected as invalid. The check is applied to the final
+two's-complement byte count, consistent with the decode-side C<max_int_len>
+limit.
+
+  $asn->configure(encode => { max_int_len => 4096 });   # allow up to 32767-bit
+  $asn->configure(encode => { max_int_len => 0    });   # no limit (not 
recommended)
+
+=item max_oid_arc_len
+
+Maximum size, in encoded bytes, of a single OBJECT IDENTIFIER or RELATIVE-OID
+arc before encoding is aborted with an error. ASN.1 places no upper bound on
+an arc, but the time to encode one grows with the square of its length.
+Defaults to C<32> (224 bits; a 128-bit UUID arc needs 19 bytes). The check is
+made on the number of decimal digits, so an arc within a few bits of the limit
+may be rejected. Set to C<0> to disable the limit; negative values are
+rejected as invalid.
+
+  $asn->configure(encode => { max_oid_arc_len => 64 });   # allow up to 
448-bit arcs
+  $asn->configure(encode => { max_oid_arc_len => 0  });   # no limit (not 
recommended)
+
 =back
 
 Decode options
@@ -165,6 +193,43 @@
 controls the big integer class into which the objects will be blessed.
 The default is to use Math::BigInt.
 
+=item max_int_len
+
+Maximum number of content bytes accepted for an INTEGER or ENUMERATED element
+greater than 32 bits before decoding is aborted with an error. Prevents a
+remote peer from causing quadratic CPU usage by sending a very large integer
+value. Defaults to C<1025> (enough for an RSA-8192 modulus, which requires a
+leading sign byte). Set to C<0> to disable the limit; negative values are
+rejected as invalid.
+
+  $asn->configure(decode => { max_int_len => 4096 });   # allow up to 32767-bit
+  $asn->configure(decode => { max_int_len => 0    });   # no limit (not 
recommended)
+
+=item max_depth
+
+Maximum number of nested C<_decode> calls permitted before decoding is aborted
+with an error. Each SEQUENCE, SET, EXPLICIT tag, constructed string, or CHOICE
+without a tag adds one level. Prevents a remote peer from causing unbounded
+stack growth by sending deeply nested structures. Defaults to C<99>, which is
+sufficient for any real-world X.509 certificate, LDAP message, or SNMP PDU,
+and stays below Perl's built-in deep-recursion warning threshold of 100.
+Set to C<0> to disable the limit; negative values are rejected as invalid.
+
+  $asn->configure(decode => { max_depth => 256 });   # allow deeper nesting
+  $asn->configure(decode => { max_depth => 0   });   # no limit (not 
recommended)
+
+=item max_oid_arc_len
+
+Maximum size, in encoded bytes, of a single OBJECT IDENTIFIER or RELATIVE-OID
+arc before decoding is aborted with an error. ASN.1 places no upper bound on
+an arc, but the time to decode one grows with the square of its length, so a
+remote peer could otherwise consume unbounded CPU with a single large arc.
+Defaults to C<32> (224 bits; a 128-bit UUID arc needs 19 bytes). Set to C<0>
+to disable the limit; negative values are rejected as invalid.
+
+  $asn->configure(decode => { max_oid_arc_len => 64 });   # allow up to 
448-bit arcs
+  $asn->configure(decode => { max_oid_arc_len => 0  });   # no limit (not 
recommended)
+
 =item null
 
 The value to decode ASN.1 NULL types into.
@@ -231,6 +296,13 @@
 cases the empty string will be returned. This is the same behaviour
 as the C<recv> function in perl itself.
 
+If the available data does not contain a complete, decodable BER element
+(truncated tag, incomplete length field, or declared length exceeding the
+datagram), BUFFER is set to the empty string and the sender address is
+returned. On a SOCK_DGRAM socket the offending datagram is also removed
+from the queue, so it cannot block the datagrams behind it, unless FLAGS
+includes MSG_PEEK, in which case it is left in place.
+
 It is recommended that if the socket is of type SOCK_DGRAM then C<recv>
 be called directly instead of calling C<asn_recv>.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/20integer_max_len.t 
new/Convert-ASN1-0.37/t/20integer_max_len.t
--- old/Convert-ASN1-0.36/t/20integer_max_len.t 1970-01-01 01:00:00.000000000 
+0100
+++ new/Convert-ASN1-0.37/t/20integer_max_len.t 2026-11-19 23:30:01.000000000 
+0100
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+# Tests for the max_int_len cap on INTEGER decode (F1 fix).
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1 qw(asn_encode_length);
+BEGIN { require './t/funcs.pl' }
+
+print "1..11\n";
+
+# Build a minimal BER-encoded INTEGER from raw content bytes.
+sub make_integer {
+    my $content = shift;
+    return pack("C", 0x02) . asn_encode_length(length $content) . $content;
+}
+
+my ($asn, $ret, $ok);
+
+# --- schema used for all decode tests ---
+btest 1, $asn = Convert::ASN1->new or warn $asn->error;
+btest 2, $asn->prepare('n INTEGER') or warn $asn->error;
+
+# --- 3: a 5-byte INTEGER (> 4 bytes) passes the default 1024-byte cap ---
+$asn->configure(decode => { bigint => 'Math::BigInt' });
+my $five = make_integer("\x00" x 4 . "\x05");
+btest 3, $ret = $asn->decode($five) or warn $asn->error;
+
+# --- 4: a 1025-byte INTEGER is rejected by the default 1024-byte cap ---
+my $big = make_integer("\x00" x 1025);
+$asn->configure(decode => { bigint => 'Math::BigInt', max_int_len => 1024 });
+btest 4, !defined($asn->decode($big))
+    or print "# expected decode to fail on oversized INTEGER\n";
+
+# --- 5: the error message mentions max_int_len ---
+$asn->decode($big);
+btest 5, (defined $asn->error && $asn->error =~ /max_int_len/);
+
+# --- 6: exactly 1024 bytes is accepted by the default cap ---
+my $exact = make_integer("\x01" . "\x00" x 1023);
+btest 6, defined($asn->decode($exact)) or warn $asn->error;
+
+# --- 7: raising the cap to 2048 allows a 1025-byte INTEGER ---
+my $asn2 = Convert::ASN1->new;
+$asn2->prepare('n INTEGER');
+$asn2->configure(decode => { bigint => 'Math::BigInt', max_int_len => 2048 });
+btest 7, defined($asn2->decode($big)) or warn $asn2->error;
+
+# --- 8: setting max_int_len => 0 disables the cap entirely ---
+my $asn3 = Convert::ASN1->new;
+$asn3->prepare('n INTEGER');
+$asn3->configure(decode => { bigint => 'Math::BigInt', max_int_len => 0 });
+my $big2 = make_integer("\x01" . "\x00" x 1500);
+btest 8, defined($asn3->decode($big2)) or warn $asn3->error;
+
+# --- 9: cap of 10 rejects an 11-byte INTEGER ---
+my $asn4 = Convert::ASN1->new;
+$asn4->prepare('n INTEGER');
+$asn4->configure(decode => { bigint => 'Math::BigInt', max_int_len => 10 });
+my $eleven = make_integer("\x00" x 11);
+btest 9, !defined($asn4->decode($eleven));
+
+# --- 10: cap of 10 passes a 4-byte INTEGER (small native path, no os2ip) ---
+my $four = make_integer(pack "N", 0x7fffffff);
+btest 10, defined($asn4->decode($four)) or warn $asn4->error;
+
+# --- 11: negative max_int_len is a hard error ---
+my $asn5 = Convert::ASN1->new;
+$asn5->prepare('n INTEGER');
+$asn5->configure(decode => { bigint => 'Math::BigInt', max_int_len => -1 });
+btest 11, !defined($asn5->decode($five)) && ($asn5->error || '') =~ 
/max_int_len must not be negative/;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/22asn_recv_truncated.t 
new/Convert-ASN1-0.37/t/22asn_recv_truncated.t
--- old/Convert-ASN1-0.36/t/22asn_recv_truncated.t      1970-01-01 
01:00:00.000000000 +0100
+++ new/Convert-ASN1-0.37/t/22asn_recv_truncated.t      2026-11-19 
23:30:01.000000000 +0100
@@ -0,0 +1,153 @@
+#!/usr/bin/perl
+# Tests for asn_recv truncated-header (F2) and datagram-wedge (F3) fixes.
+# A truncated packet must return '' rather than OOM, and must be consumed
+# so that subsequent valid packets are delivered.
+
+use strict;
+use warnings;
+use lib 'lib';
+use Socket;
+use Convert::ASN1 qw(:io);
+BEGIN { require './t/funcs.pl' }
+
+print "1..19\n";
+
+# Create a connected UDP socketpair over loopback.
+sub udp_pair {
+    socket(my $a, AF_INET, SOCK_DGRAM, 0) or die "socket: $!";
+    socket(my $b, AF_INET, SOCK_DGRAM, 0) or die "socket: $!";
+    bind($a, sockaddr_in(0, inet_aton('127.0.0.1'))) or die "bind a: $!";
+    bind($b, sockaddr_in(0, inet_aton('127.0.0.1'))) or die "bind b: $!";
+    my $addr_a = getsockname($a);
+    my $addr_b = getsockname($b);
+    connect($a, $addr_b) or die "connect a: $!";
+    connect($b, $addr_a) or die "connect b: $!";
+    return ($a, $b);
+}
+
+# --- 1-2: single-byte tag \x30 returns '' without OOM ---
+{
+    my ($sender, $receiver) = udp_pair();
+    send($sender, "\x30", 0) or die "send: $!";
+    my $buf;
+    my $peer = asn_recv($receiver, $buf, 0);
+    btest 1, defined $peer;
+    btest 2, defined($buf) && $buf eq '';
+    close $sender; close $receiver;
+}
+
+# --- 3-4: two-byte truncated long-form length \x30\x84 returns '' without OOM 
---
+{
+    my ($sender, $receiver) = udp_pair();
+    send($sender, "\x30\x84", 0) or die "send: $!";
+    my $buf;
+    my $peer = asn_recv($receiver, $buf, 0);
+    btest 3, defined $peer;
+    btest 4, defined($buf) && $buf eq '';
+    close $sender; close $receiver;
+}
+
+# --- 5-6: a valid element is still delivered correctly ---
+{
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x03\x02\x01\x05";   # SEQUENCE { INTEGER 5 }
+    send($sender, $pdu, 0) or die "send: $!";
+    my $buf;
+    asn_recv($receiver, $buf, 0);
+    btest 5, defined $buf;
+    btest 6, $buf eq $pdu;
+    close $sender; close $receiver;
+}
+
+# --- 7-8: bad datagram is consumed; good datagram following it is delivered 
(F3) ---
+{
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x03\x02\x01\x05";
+    send($sender, "\x30", 0)  or die "send: $!";   # bad: truncated tag
+    send($sender, $pdu, 0)    or die "send: $!";   # good: follows immediately
+    my $buf;
+    asn_recv($receiver, $buf, 0);                  # consumes the bad datagram
+    btest 7, defined($buf) && $buf eq '';
+    asn_recv($receiver, $buf, 0);                  # delivers the good one
+    btest 8, defined($buf) && $buf eq $pdu;
+    close $sender; close $receiver;
+}
+
+# --- 9-10: truncated long-form length consumed; good datagram following 
delivered ---
+{
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x03\x02\x01\x07";
+    send($sender, "\x30\x84", 0) or die "send: $!";
+    send($sender, $pdu, 0)       or die "send: $!";
+    my $buf;
+    asn_recv($receiver, $buf, 0);
+    btest 9, defined($buf) && $buf eq '';
+    asn_recv($receiver, $buf, 0);
+    btest 10, defined($buf) && $buf eq $pdu;
+    close $sender; close $receiver;
+}
+
+# --- 11-14: MSG_PEEK on a bad datagram leaves it queued; a normal read then
+# consumes it and the following good datagram is delivered ---
+{
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x03\x02\x01\x09";
+    send($sender, "\x30", 0) or die "send: $!";
+    send($sender, $pdu, 0)   or die "send: $!";
+    my $buf;
+    asn_recv($receiver, $buf, MSG_PEEK);
+    btest 11, defined($buf) && $buf eq '';
+    recv($receiver, my $raw, 64, MSG_PEEK);
+    btest 12, defined($raw) && $raw eq "\x30";      # still at the head of the 
queue
+    asn_recv($receiver, $buf, 0);
+    btest 13, defined($buf) && $buf eq '';
+    my $rin = '';
+    vec($rin, fileno($receiver), 1) = 1;
+    $buf = undef;
+    asn_recv($receiver, $buf, 0) if select($rin, undef, undef, 1);
+    btest 14, defined($buf) && $buf eq $pdu;
+    close $sender; close $receiver;
+}
+
+# --- 15-17: a complete header declaring a huge length must not make perl
+# allocate a buffer of that size ---
+{
+    my $vmpeak = sub {
+        open(my $fh, '<', '/proc/self/status') or return;
+        while (<$fh>) { return $1 if /^VmPeak:\s+(\d+)/ }
+        return;
+    };
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x03\x02\x01\x0b";
+    send($sender, "\x30\x84\x7f\xff\xff\xff", 0) or die "send: $!";   # 
declares ~2GB
+    send($sender, $pdu, 0)                       or die "send: $!";
+    my $before = $vmpeak->();
+    my $buf;
+    asn_recv($receiver, $buf, 0);
+    my $after = $vmpeak->();
+    btest 15, defined($buf) && $buf eq '';
+    asn_recv($receiver, $buf, 0);
+    btest 16, defined($buf) && $buf eq $pdu;
+    if (defined $before && defined $after) {
+        btest 17, $after - $before < 64 * 1024;     # kB
+    }
+    else {
+        print "ok 17 # skip no /proc/self/status\n";
+    }
+    close $sender; close $receiver;
+}
+
+# --- 18-19: an element larger than the first peek is still delivered whole,
+# and one whose declared length exceeds the datagram is rejected ---
+{
+    my ($sender, $receiver) = udp_pair();
+    my $pdu = "\x30\x82\x13\x88" . ("\x05\x00" x 2500);     # 5004 bytes
+    send($sender, $pdu, 0) or die "send: $!";
+    my $buf;
+    asn_recv($receiver, $buf, 0);
+    btest 18, defined($buf) && $buf eq $pdu;
+    send($sender, substr($pdu, 0, 300), 0) or die "send: $!";
+    asn_recv($receiver, $buf, 0);
+    btest 19, defined($buf) && $buf eq '';
+    close $sender; close $receiver;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/23dec_real.t 
new/Convert-ASN1-0.37/t/23dec_real.t
--- old/Convert-ASN1-0.36/t/23dec_real.t        1970-01-01 01:00:00.000000000 
+0100
+++ new/Convert-ASN1-0.37/t/23dec_real.t        2026-11-19 23:30:01.000000000 
+0100
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+# Tests for _dec_real exponent bounds fix (F4).
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1;
+BEGIN { require './t/funcs.pl' }
+
+print "1..15\n";
+
+my ($asn, $ret);
+
+btest 1, $asn = Convert::ASN1->new;
+btest 2, $asn->prepare('r REAL') or warn $asn->error;
+
+# Helper: build a BER REAL from raw content bytes.
+sub make_real { "\x09" . chr(length $_[0]) . $_[0] }
+
+# --- 3: zero-length REAL decodes to 0.0 ---
+btest 3, $ret = $asn->decode(make_real('')) or warn $asn->error;
+btest 4, $ret->{r} == 0.0;
+
+# --- 5: valid binary REAL (1.0 base-2: first=0x80, exp=0, mant=1) ---
+# 09 03 80 00 01  -> binary, exp=0, mant=1 -> 1.0
+my $one = make_real("\x80\x00\x01");
+btest 5, $ret = $asn->decode($one) or warn $asn->error;
+btest 6, $ret->{r} == 1.0;
+
+# --- 7: expLen > content length is rejected (buffer overread / quadratic) ---
+# 09 01 80  -> binary, expLen=1, but content is only 1 byte (the first byte) 
-> invalid
+my $overread = make_real("\x80");
+btest 7, !defined($asn->decode($overread));
+btest 8, ($asn->error || '') =~ /REAL decode error/;
+
+# --- 9: long-form exponent off-by-one fix: valid encoding gives correct value 
---
+# Binary REAL, long-form exponent (bits 0-1 = 11 = 3 -> long form):
+# first = 0x83 (binary, base-2, long-exp), expLen-byte = 0x01, exp = 0x00, 
mant = 0x01
+# -> 1.0
+my $longexp = make_real("\x83\x01\x00\x01");
+btest 9, $ret = $asn->decode($longexp) or warn $asn->error;
+btest 10, $ret->{r} == 1.0;
+
+# --- 11-12: a 4-byte long-form exponent still decodes ---
+# first = 0x83, expLen-byte = 0x04, exp = 0, mant = 0x01 -> 1.0
+btest 11, $ret = $asn->decode(make_real("\x83\x04\x00\x00\x00\x00\x01")) or 
warn $asn->error;
+btest 12, $ret && $ret->{r} == 1.0;
+
+# --- 13-15: an exponent longer than 4 bytes is rejected; decoding it as a
+# bigint would make pow() compute an enormous exact power ---
+my $t = time;
+local $SIG{ALRM} = sub { die "timeout\n" };
+eval { alarm 10 };    # fail rather than hang if the check is lost
+btest 13, 
!defined($asn->decode(make_real("\x83\x05\x01\x01\x01\x01\x01\xff")));
+eval { alarm 0 };
+btest 14, ($asn->error || '') =~ /REAL decode error/;
+btest 15, time - $t < 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/24enc_integer_validate.t 
new/Convert-ASN1-0.37/t/24enc_integer_validate.t
--- old/Convert-ASN1-0.36/t/24enc_integer_validate.t    1970-01-01 
01:00:00.000000000 +0100
+++ new/Convert-ASN1-0.37/t/24enc_integer_validate.t    2026-11-19 
23:30:01.000000000 +0100
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+# Tests for _enc_integer exponent-string validation fix (F5).
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1;
+use Math::BigInt;
+BEGIN { require './t/funcs.pl' }
+
+print "1..23\n";
+
+my ($asn, $ret);
+btest 1, $asn = Convert::ASN1->new;
+btest 2, $asn->prepare('n INTEGER') or warn $asn->error;
+
+# --- 3-4: non-numeric strings are rejected ---
+btest 3, do { local $SIG{__WARN__} = sub {}; !defined($asn->encode(n => 
"12345678901abc")) };
+btest 4, ($asn->error || '') =~ /not an integer/;
+
+# --- 5: plain large integer string encodes correctly ---
+btest 5, defined($asn->encode(n => "10000000000")) or warn $asn->error;
+
+# --- 6: Math::BigInt object encodes correctly ---
+btest 6, defined($asn->encode(n => Math::BigInt->new("100000000000"))) or warn 
$asn->error;
+
+# --- 7: negative large integer string encodes correctly ---
+btest 7, defined($asn->encode(n => "-10000000000")) or warn $asn->error;
+
+# --- 8: round-trip of a large integer ---
+$asn->configure(decode => { bigint => 'Math::BigInt' });
+my $big = Math::BigInt->new("1092509802939879587398450394850984098031948509");
+my $enc = $asn->encode(n => $big);
+btest 8, defined $enc or warn $asn->error;
+$ret = $asn->decode($enc);
+btest 9, defined $ret or warn $asn->error;
+btest 10, $ret->{n} == $big;
+
+# --- 11-12: default max_int_len=1025 rejects integers > 1025 BER bytes ---
+# 2^8200 encodes to 1026 bytes (no sign pad needed; i2osp msb is clear)
+my $huge = Math::BigInt->new(2)->bpow(8200);
+btest 11, !defined($asn->encode(n => $huge));
+btest 12, ($asn->error || '') =~ /too large/;
+
+# --- 13: max_int_len => 0 disables the cap ---
+$asn->configure(encode => { max_int_len => 0 });
+btest 13, defined($asn->encode(n => $huge)) or warn $asn->error;
+
+# --- 14: max_int_len => 2048 allows 1026-byte integer ---
+$asn->configure(encode => { max_int_len => 2048 });
+btest 14, defined($asn->encode(n => $huge)) or warn $asn->error;
+
+# --- 15: negative max_int_len is a hard error ---
+$asn->configure(encode => { max_int_len => -1 });
+btest 15, !defined($asn->encode(n => Math::BigInt->new("100000000000"))) &&
+          ($asn->error || '') =~ /max_int_len must not be negative/;
+
+# --- 16-23: exponent-form and '+'-signed values encode as they did before the
+# integer check was added; huge exponents are rejected before bigint expansion 
---
+{
+    my $e = Convert::ASN1->new;
+    $e->prepare('n INTEGER') or warn $e->error;
+    $e->configure(decode => { bigint => 'Math::BigInt' });
+
+    my $r = $e->decode($e->encode(n => "1e20") || '');
+    btest 16, $r && $r->{n} == Math::BigInt->new("100000000000000000000") or 
warn $e->error;
+
+    $r = $e->decode($e->encode(n => "+5000000000") || '');
+    btest 17, $r && $r->{n} == 5000000000 or warn $e->error;
+
+    $r = $e->decode($e->encode(n => "-3e15") || '');
+    btest 18, $r && $r->{n} == Math::BigInt->new("-3000000000000000") or warn 
$e->error;
+
+    btest 19, defined($e->encode(n => 2**64)) or warn $e->error;
+
+    my $t = time;
+    btest 20, !defined($e->encode(n => "1e100000000"));
+    btest 21, ($e->error || '') =~ /too large/;
+    btest 22, time - $t < 2;
+
+    btest 23, !defined($e->encode(n => "12345678901.5")) &&
+              ($e->error || '') =~ /not an integer/;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/25dec_bitstring_zero_len.t 
new/Convert-ASN1-0.37/t/25dec_bitstring_zero_len.t
--- old/Convert-ASN1-0.36/t/25dec_bitstring_zero_len.t  1970-01-01 
01:00:00.000000000 +0100
+++ new/Convert-ASN1-0.37/t/25dec_bitstring_zero_len.t  2026-11-19 
23:30:01.000000000 +0100
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+# Tests for _dec_bitstring zero-length content guard (F6).
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1 qw(asn_encode_length);
+BEGIN { require './t/funcs.pl' }
+
+print "1..10\n";
+
+sub make_bitstring {
+    my $content = shift;
+    return pack("C", 0x03) . asn_encode_length(length $content) . $content;
+}
+
+my ($asn, $ret);
+btest 1, $asn = Convert::ASN1->new;
+btest 2, $asn->prepare('b BIT STRING') or warn $asn->error;
+
+# --- 3-4: zero-length BIT STRING decodes to empty string with 0 bits ---
+my $zero = make_bitstring('');
+btest 3, $ret = $asn->decode($zero) or warn $asn->error;
+btest 4, defined($ret) && $ret->{b}[0] eq '' && $ret->{b}[1] == 0;
+
+# --- 5-6: a valid non-empty BIT STRING still decodes correctly ---
+# content: 0x00 (0 unused bits) + 0xA0 (data byte)
+my $valid = make_bitstring("\x00\xA0");
+btest 5, $ret = $asn->decode($valid) or warn $asn->error;
+btest 6, defined($ret) && $ret->{b}[0] eq "\xA0" && $ret->{b}[1] == 8;
+
+# --- 7-8: constructed BIT STRING (tag 0x23) with 500 zero-length fragments
+# doesn't cause quadratic memory (mini-PoC scenario) ---
+btest 7, $asn->prepare('x BIT STRING') or warn $asn->error;
+my $frags = make_bitstring('') x 500;
+my $cbs = pack("C", 0x23) . asn_encode_length(length $frags) . $frags;
+my $t = time;
+$ret = $asn->decode($cbs);
+btest 8, time - $t < 5;
+
+# --- 9-10: unused-bits byte > 7 is rejected ---
+my $bad_unused = make_bitstring("\x08\xFF");   # 8 unused bits = invalid
+btest 9, !defined($asn->decode($bad_unused));
+btest 10, ($asn->error || '') =~ /BIT STRING decode error/;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/26dec_depth_limit.t 
new/Convert-ASN1-0.37/t/26dec_depth_limit.t
--- old/Convert-ASN1-0.36/t/26dec_depth_limit.t 1970-01-01 01:00:00.000000000 
+0100
+++ new/Convert-ASN1-0.37/t/26dec_depth_limit.t 2026-11-19 23:30:01.000000000 
+0100
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+# Tests for _decode nesting depth limit (F7).
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1 qw(asn_encode_length);
+BEGIN { require './t/funcs.pl' }
+
+print "1..12\n";
+
+# Build a schema with $depth levels of SEQUENCE nesting around an INTEGER.
+sub make_schema {
+    my $depth = shift;
+    my $s = 'n INTEGER';
+    $s = "x SEQUENCE { $s }" for 1 .. $depth;
+    return $s;
+}
+
+# Build matching BER input: $depth levels of SEQUENCE wrapping INTEGER value 
$v.
+sub make_input {
+    my ($depth, $v) = @_;
+    my $buf = "\x02\x01" . chr($v);
+    $buf = pack("C", 0x30) . asn_encode_length(length $buf) . $buf for 1 .. 
$depth;
+    return $buf;
+}
+
+my ($asn, $ret);
+btest 1, $asn = Convert::ASN1->new;
+
+# --- 2-3: 2 levels passes max_depth => 3 ---
+$asn->configure(decode => { max_depth => 3 });
+btest 2, $asn->prepare(make_schema(2)) or warn $asn->error;
+btest 3, defined($asn->decode(make_input(2, 7))) or warn $asn->error;
+
+# --- 4-6: 3 levels exceeds max_depth => 3 (depth reaches 4) ---
+btest 4, $asn->prepare(make_schema(3)) or warn $asn->error;
+btest 5, !defined($asn->decode(make_input(3, 7)));
+btest 6, ($asn->error || '') =~ /depth/;
+
+# --- 7: max_depth => 0 disables the limit ---
+$asn->configure(decode => { max_depth => 0 });
+btest 7, defined($asn->decode(make_input(3, 7))) or warn $asn->error;
+
+# --- 8: raising max_depth to 10 allows 3 levels ---
+$asn->configure(decode => { max_depth => 10 });
+btest 8, defined($asn->decode(make_input(3, 7))) or warn $asn->error;
+
+# --- 9: negative max_depth is a hard error ---
+$asn->configure(decode => { max_depth => -1 });
+btest 9, !defined($asn->decode(make_input(3, 7))) && ($asn->error || '') =~ 
/max_depth must not be negative/;
+
+# --- 10-12: depth error inside an untagged CHOICE alternative aborts the 
decode
+# rather than being treated as a non-match; otherwise each level retries every
+# alternative and the work grows as 2**max_depth ---
+{
+    my $levels = 30;
+    my $schema = "L0 ::= INTEGER\n";
+    $schema .= "L$_ ::= CHOICE { a L" . ($_ - 1) . ", b L" . ($_ - 1) . " }\n" 
for 1 .. $levels;
+    my $choice = Convert::ASN1->new;
+    $choice->configure(decode => { max_depth => 22 });
+    btest 10, $choice->prepare($schema) or warn $choice->error;
+    my $top = $choice->find("L$levels");
+    my $t = time;
+    btest 11, !defined($top->decode("\x04\x01\x41")) && ($top->error || '') =~ 
/depth/;
+    btest 12, time - $t < 2;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/27asn_read_length.t 
new/Convert-ASN1-0.37/t/27asn_read_length.t
--- old/Convert-ASN1-0.36/t/27asn_read_length.t 1970-01-01 01:00:00.000000000 
+0100
+++ new/Convert-ASN1-0.37/t/27asn_read_length.t 2026-11-19 23:30:01.000000000 
+0100
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+# asn_read and asn_get must not size their read buffer from the length an
+# element declares; memory should track the data actually received.
+
+use strict;
+use warnings;
+use lib 'lib';
+use File::Temp qw(tempfile);
+use Convert::ASN1 qw(:io);
+BEGIN { require './t/funcs.pl' }
+
+print "1..10\n";
+
+sub vmpeak {
+    open(my $fh, '<', '/proc/self/status') or return;
+    while (<$fh>) { return $1 if /^VmPeak:\s+(\d+)/ }
+    return;
+}
+
+# Return a read handle on a temporary file holding $data.
+sub handle_for {
+    my $data = shift;
+    my ($fh, $name) = tempfile(UNLINK => 1);
+    binmode $fh;
+    print $fh $data;
+    close $fh;
+    open(my $in, '<', $name) or die "open: $!";
+    binmode $in;
+    return $in;
+}
+
+sub mem_test {
+    my ($num, $before, $after) = @_;
+    if (defined $before && defined $after) {
+        btest $num, $after - $before < 64 * 1024;     # kB
+    }
+    else {
+        print "ok $num # skip no /proc/self/status\n";
+    }
+}
+
+my $huge = "\x30\x84\x7f\xff\xff\xff" . ("A" x 100);    # declares ~2GB, holds 
100 bytes
+
+# --- 1-2: asn_read fails on the short input without a huge allocation ---
+{
+    my $in = handle_for($huge);
+    my $before = vmpeak();
+    my $buf;
+    my $ret = asn_read($in, $buf);
+    my $after = vmpeak();
+    btest 1, !defined $ret;
+    mem_test 2, $before, $after;
+}
+
+# --- 3-4: asn_get fails on the short input without a huge allocation ---
+{
+    my $in = handle_for($huge);
+    my $before = vmpeak();
+    my $ret = asn_get($in);
+    my $after = vmpeak();
+    btest 3, !defined $ret;
+    mem_test 4, $before, $after;
+}
+
+# An element larger than a single read, followed by a small one.
+my $big   = "\x04\x83\x03\x0d\x40" . ("B" x 200_000);
+my $small = "\x30\x03\x02\x01\x05";
+
+# --- 5-7: asn_read returns exactly one element at a time ---
+{
+    my $in = handle_for($big . $small);
+    my $buf;
+    my $ret = asn_read($in, $buf);
+    btest 5, defined($ret) && $ret == length $big;
+    btest 6, $buf eq $big;
+    asn_read($in, $buf);
+    btest 7, $buf eq $small;
+}
+
+# --- 8-10: asn_get returns each element whole ---
+{
+    my $in = handle_for($big . $small);
+    my $ret = asn_get($in);
+    btest 8, defined($ret) && $ret eq $big;
+    $ret = asn_get($in);
+    btest 9, defined($ret) && $ret eq $small;
+    btest 10, !defined asn_get($in);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Convert-ASN1-0.36/t/28oid_arc_limit.t 
new/Convert-ASN1-0.37/t/28oid_arc_limit.t
--- old/Convert-ASN1-0.36/t/28oid_arc_limit.t   1970-01-01 01:00:00.000000000 
+0100
+++ new/Convert-ASN1-0.37/t/28oid_arc_limit.t   2026-11-19 23:30:01.000000000 
+0100
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+# OBJECT IDENTIFIER and RELATIVE-OID arcs are limited in size, because
+# pack/unpack "w" take quadratic time on a very large arc.
+
+use strict;
+use warnings;
+use lib 'lib';
+use Convert::ASN1 qw(asn_encode_length);
+BEGIN { require './t/funcs.pl' }
+
+print "1..28\n";
+
+sub tlv { pack("C", $_[0]) . asn_encode_length(length $_[1]) . $_[1] }
+
+my ($asn, $rel, $ret, $enc, $t);
+btest 1, $asn = Convert::ASN1->new;
+btest 2, $asn->prepare('o OBJECT IDENTIFIER') or warn $asn->error;
+btest 3, $rel = Convert::ASN1->new;
+btest 4, $rel->prepare('o RELATIVE-OID') or warn $rel->error;
+
+# --- 5-6: ordinary and UUID-arc OIDs still round-trip ---
+for my $case ([5, '1.2.840.113549.1.1.11'],
+              [6, '2.25.329800735698586629295641978511506172918']) {
+    $enc = $asn->encode(o => $case->[1]);
+    $ret = defined $enc ? $asn->decode($enc) : undef;
+    btest $case->[0], $ret && $ret->{o} eq $case->[1] or warn $asn->error;
+}
+
+# --- 7-9: a huge arc is rejected on decode, quickly ---
+$t = time;
+btest 7, !defined($asn->decode(tlv(0x06, "\x2a" . ("\xff" x 60_000) . 
"\x7f")));
+btest 8, ($asn->error || '') =~ /arc too large/;
+btest 9, time - $t < 2;
+
+# --- 10-11: a 32-byte arc decodes, a 33-byte arc does not ---
+btest 10, defined($asn->decode(tlv(0x06, "\x2a" . ("\x81" x 31) . "\x01"))) or 
warn $asn->error;
+btest 11, !defined($asn->decode(tlv(0x06, "\x2a" . ("\x81" x 32) . "\x01")));
+
+# --- 12-13: RELATIVE-OID uses the same limit ---
+btest 12, !defined($rel->decode(tlv(0x0d, ("\xff" x 60_000) . "\x7f")));
+btest 13, ($rel->error || '') =~ /arc too large/;
+
+# --- 14-16: a huge arc is rejected on encode, quickly ---
+$t = time;
+btest 14, !defined($asn->encode(o => '1.2.' . ('9' x 80_000)));
+btest 15, ($asn->error || '') =~ /arc too large/;
+btest 16, time - $t < 2;
+
+# --- 17-18: a 67-digit arc encodes and decodes back, a 68-digit arc does not 
---
+my $oid67 = '1.2.' . ('9' x 67);
+$enc = $asn->encode(o => $oid67);
+$ret = defined $enc ? $asn->decode($enc) : undef;
+btest 17, $ret && $ret->{o} eq $oid67 or warn $asn->error;
+btest 18, !defined($asn->encode(o => '1.2.' . ('9' x 68)));
+
+# --- 19: RELATIVE-OID encode uses the same limit ---
+btest 19, !defined($rel->encode(o => '5.' . ('9' x 80_000)));
+
+# --- 20-28: the limit is configurable through max_oid_arc_len ---
+my $arc33 = tlv(0x06, "\x2a" . ("\x81" x 32) . "\x01");     # one 33-byte arc
+my $oid68 = '1.2.' . ('9' x 68);
+
+my $cfg = Convert::ASN1->new;
+$cfg->prepare('o OBJECT IDENTIFIER') or warn $cfg->error;
+
+$cfg->configure(decode => { max_oid_arc_len => 64 }, encode => { 
max_oid_arc_len => 64 });
+btest 20, defined($cfg->decode($arc33)) or warn $cfg->error;
+btest 21, defined($cfg->encode(o => $oid68)) or warn $cfg->error;
+btest 22, !defined($cfg->decode(tlv(0x06, "\x2a" . ("\x81" x 64) . "\x01")));
+
+$cfg->configure(decode => { max_oid_arc_len => 0 }, encode => { 
max_oid_arc_len => 0 });
+btest 23, defined($cfg->decode(tlv(0x06, "\x2a" . ("\x81" x 500) . "\x01"))) 
or warn $cfg->error;
+btest 24, defined($cfg->encode(o => '1.2.' . ('9' x 1000))) or warn 
$cfg->error;
+
+$cfg->configure(decode => { max_oid_arc_len => 8 }, encode => { 
max_oid_arc_len => 8 });
+btest 25, !defined($cfg->decode(tlv(0x06, "\x2a" . ("\x81" x 8) . "\x01")));
+btest 26, !defined($cfg->encode(o => '1.2.' . ('9' x 17)));
+
+$cfg->configure(decode => { max_oid_arc_len => -1 }, encode => { 
max_oid_arc_len => -1 });
+btest 27, !defined($cfg->decode($arc33)) && ($cfg->error || '') =~ 
/max_oid_arc_len must not be negative/;
+btest 28, !defined($cfg->encode(o => '1.2.3')) && ($cfg->error || '') =~ 
/max_oid_arc_len must not be negative/;

++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.Co8gxK/_old  2026-12-01 16:58:15.105304528 +0100
+++ /var/tmp/diff_new_pack.Co8gxK/_new  2026-12-01 16:58:15.109304696 +0100
@@ -1,6 +1,6 @@
-mtime: 1794317385
-commit: 18e2255e32f9ba5b6f84959c5accda1d869c2894e942c0e5812c1fa3f832d3ce
+mtime: 1795727047
+commit: 9c5b30fb8084a81e4e02871f0ed16d288d292eb258da9cb12653001505141a32
 url: https://src.opensuse.org/perl/perl-Convert-ASN1
-revision: 18e2255e32f9ba5b6f84959c5accda1d869c2894e942c0e5812c1fa3f832d3ce
+revision: 9c5b30fb8084a81e4e02871f0ed16d288d292eb258da9cb12653001505141a32
 projectscmsync: https://src.opensuse.org/perl/_ObsPrj
 

++++++ build.specials.obscpio ++++++

++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore      2026-11-26 22:04:07.000000000 +0100
@@ -0,0 +1 @@
+.osc

Reply via email to