| 1 | # Copyright (c) 2000-2005 Graham Barr <gbarr@pobox.com>. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Convert::ASN1; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 32 | $Convert::ASN1::VERSION = '0.37'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | 32 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 32 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 32 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 32 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 32 | ▶ | eval { require bytes and 'bytes'->import }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # These are the subs that do the decode, they are called with | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # 0 1 2 3 4 | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # $optn, $op, $stash, $var, $buf | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # The order must be the same as the op definitions above | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | my @decode = ( | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub { die "internal error\n" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 32 | \&_dec_boolean, | |||||||||||||||||||||||||||||||||||||||||
| 23 | \&_dec_integer, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | \&_dec_bitstring, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | \&_dec_string, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | \&_dec_null, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | \&_dec_object_id, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | \&_dec_real, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | \&_dec_sequence, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | \&_dec_explicit, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | \&_dec_set, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | \&_dec_time, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | \&_dec_time, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | \&_dec_utf8, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | undef, # ANY | ||||||||||||||||||||||||||||||||||||||||||
| 36 | undef, # CHOICE | ||||||||||||||||||||||||||||||||||||||||||
| 37 | \&_dec_object_id, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | \&_dec_bcd, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 32 | my @ctr; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 32 | @ctr[opBITSTR, opSTRING, opUTF8] = (\&_ctr_bitstring,\&_ctr_string,\&_ctr_string); | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 641 | ▶ | sub _decode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode: called CC=81 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 641 | my ($optn, $ops, $stash, $pos, $end, $seqof, $larr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 641 | ▶ | my $max_depth = exists $optn->{decode_max_depth} ? $optn->{decode_max_depth} : 99; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 641 | ▶ | local $optn->{_decode_depth} = ($optn->{_decode_depth} || 0) + 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$optn->{'_decode_depth'} || 0
MC/DC100%1/1
$optn->{'_decode_depth'} || 0
$optn->{'_decode_depth'}
Truth table100%2/2
A
A= $optn->{'_decode_depth'}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 641 | ▶ | die "decode: max_depth must not be negative\n" if $max_depth < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | die "decode error (nesting depth limit exceeded)\n" | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 640 | ▶ | if $max_depth > 0 && $optn->{_decode_depth} > $max_depth; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max_depth > 0 and $optn->{"_decode_depth"} > $max_depth
MC/DC100%2/2
$max_depth > 0 and $optn->{"_decode_depth"} > $max_depth
$max_depth > 0
$optn->{"_decode_depth"} > $max_depth
Truth table100%3/3
A and B
A= $max_depth > 0B= $optn->{"_decode_depth"} > $max_depth
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 638 | my $idx = 0; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # we try not to copy the input buffer at any time | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 638 | foreach my $buf ($_[-1]) { | |||||||||||||||||||||||||||||||||||||||||
| 58 | OP: | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 638 | foreach my $op (@{$ops}) { | |||||||||||||||||||||||||||||||||||||||||
| 60 | 1110 | my $var = $op->[cVAR]; | |||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1110 | ▶ | if (length $op->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | TAGLOOP: { | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 844 | my($tag,$len,$npos,$indef) = _decode_tl($buf,$pos,$end,$larr) | |||||||||||||||||||||||||||||||||||||||||
| 66 | 1462 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 25 | ▶ | next OP if $pos==$end and ($seqof || defined $op->[cEXT]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$pos == $end and $seqof || defined $op->[5]
$seqof or defined $op->[5]
MC/DC33%1/3
$pos == $end and $seqof || defined $op->[5]
$pos == $end
$seqof
defined $op->[5]
Truth table50%2/4
A and B or C
A= $pos == $endB= $seqofC= defined $op->[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | die "decode error"; | |||||||||||||||||||||||||||||||||||||||||
| 69 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 1437 | ▶ | if ($tag eq $op->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1370 | &{$decode[$op->[cTYPE]]}( | |||||||||||||||||||||||||||||||||||||||||
| 74 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | $op, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | $stash, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # We send 1 if there is not var as if there is the decode | ||||||||||||||||||||||||||||||||||||||||||
| 78 | # should be getting undef. So if it does not get undef | ||||||||||||||||||||||||||||||||||||||||||
| 79 | # it knows it has no variable | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 1370 | ▶ | ($seqof ? $seqof->[$idx++] : defined($var) ? $stash->{$var} : ref($stash) eq 'SCALAR' ? $$stash : 1), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | $buf,$npos,$len, $larr | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 1354 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1354 | ▶ | redo TAGLOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$seqof and $pos < $end
MC/DC100%2/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table100%3/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 736 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 67 | ▶ | if ($tag eq ($op->[cTAG] | pack("C",ASN_CONSTRUCTOR)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tag eq ($op->[0] | " ") and my $ctr = $ctr[$op->[1]]
MC/DC50%1/2
$tag eq ($op->[0] | " ") and my $ctr = $ctr[$op->[1]]
$tag eq ($op->[0] | " ")
my $ctr = $ctr[$op->[1]]
Truth table66%2/3
A and B
A= $tag eq ($op->[0] | " ")B= my $ctr = $ctr[$op->[1]]
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | and my $ctr = $ctr[$op->[cTYPE]]) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 94 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 95 | [$op], | ||||||||||||||||||||||||||||||||||||||||||
| 96 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 97 | $npos, | ||||||||||||||||||||||||||||||||||||||||||
| 98 | $npos+$len, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | (\my @ctrlist), | ||||||||||||||||||||||||||||||||||||||||||
| 100 | $larr, | ||||||||||||||||||||||||||||||||||||||||||
| 101 | $buf, | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | ($seqof | ||||||||||||||||||||||||||||||||||||||||||
| 105 | ? $seqof->[$idx++] # = &{$ctr}(@ctrlist); | ||||||||||||||||||||||||||||||||||||||||||
| 106 | : defined($var) | ||||||||||||||||||||||||||||||||||||||||||
| 107 | ? $stash->{$var} # = &{$ctr}(@ctrlist); | ||||||||||||||||||||||||||||||||||||||||||
| 108 | : ref($stash) eq 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ? $$stash # = &{$ctr}(@ctrlist); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | : my $any ) # = &{$ctr}(@ctrlist) FIX #43 | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | ▶ | = &{$ctr}(@ctrlist); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | ▶ | redo TAGLOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqof and $pos < $end
MC/DC0%0/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table33%1/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 65 | ▶ | if ($seqof || defined $op->[cEXT]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqof or defined $op->[5]
MC/DC0%0/2
$seqof or defined $op->[5]
$seqof
defined $op->[5]
Truth table33%1/3
A or B
A= $seqofB= defined $op->[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 65 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | die "decode error " . unpack("H*",$tag) ."<=>" . unpack("H*",$op->[cTAG]), " ",$pos," ",$op->[cTYPE]," ",$op->[cVAR]||''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$op->[2] || ''
MC/DC0%0/1
$op->[2] || ''
$op->[2]
Truth table0%0/2
A
A= $op->[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | else { # opTag length is zero, so it must be an ANY, CHOICE or EXTENSIONS | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 266 | ▶ | if ($op->[cTYPE] == opANY) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | ANYLOOP: { | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 83 | my($tag,$len,$npos,$indef) = _decode_tl($buf,$pos,$end,$larr) | |||||||||||||||||||||||||||||||||||||||||
| 134 | 84 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | ▶ | next OP if $pos==$end and ($seqof || defined $op->[cEXT]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$pos == $end and $seqof || defined $op->[5]
$seqof or defined $op->[5]
MC/DC0%0/3
$pos == $end and $seqof || defined $op->[5]
$pos == $end
$seqof
defined $op->[5]
Truth table25%1/4
A and B or C
A= $pos == $endB= $seqofC= defined $op->[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | die "decode error"; | |||||||||||||||||||||||||||||||||||||||||
| 137 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 82 | $len += $npos - $pos + $indef; | |||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 82 | my $handler; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 82 | ▶ | if ($op->[cDEFINE]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | ▶ | $handler = $optn->{oidtable} && $optn->{oidtable}{$stash->{$op->[cDEFINE]}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$optn->{'oidtable'} && $optn->{'oidtable'}{$$stash{$op->[7]}}
MC/DC0%0/2
$optn->{'oidtable'} && $optn->{'oidtable'}{$$stash{$op->[7]}}
$optn->{'oidtable'}
$optn->{'oidtable'}{$$stash{$op->[7]}}
Truth table33%1/3
A && B
A= $optn->{'oidtable'}B= $optn->{'oidtable'}{$$stash{$op->[7]}}
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | ▶ | $handler ||= $optn->{handlers}{$op->[cVAR]}{$stash->{$op->[cDEFINE]}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$handler ||= $optn->{"handlers"}{$op->[2]}{$$stash{$op->[7]}}
MC/DC0%0/2
$handler ||= $optn->{"handlers"}{$op->[2]}{$$stash{$op->[7]}}
$handler
$optn->{"handlers"}{$op->[2]}{$$stash{$op->[7]}}
Truth table33%1/3
A ||= B
A= $handlerB= $optn->{"handlers"}{$op->[2]}{$$stash{$op->[7]}}
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 82 | ▶ | if ($handler) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | local $handler->{options}{_decode_depth} = $optn->{_decode_depth}; | |||||||||||||||||||||||||||||||||||||||||
| 149 | local $handler->{options}{decode_max_depth} = $max_depth | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | ▶ | unless exists $handler->{options}{decode_max_depth}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | ▶ | ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : $stash->{$var}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | = $handler->decode(substr($buf,$pos,$len)); | ||||||||||||||||||||||||||||||||||||||||||
| 153 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 80 | ▶ | ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : $stash->{$var}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | = substr($buf,$pos,$len); | ||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 82 | $pos += $len; | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 82 | ▶ | redo ANYLOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$seqof and $pos < $end
MC/DC100%2/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table100%3/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | elsif ($op->[cTYPE] == opCHOICE) { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | CHOICELOOP: { | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 179 | my($tag,$len,$npos,$indef) = _decode_tl($buf,$pos,$end,$larr) | |||||||||||||||||||||||||||||||||||||||||
| 167 | 182 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | next OP if $pos==$end and ($seqof || defined $op->[cEXT]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$pos == $end and $seqof || defined $op->[5]
$seqof or defined $op->[5]
MC/DC0%0/3
$pos == $end and $seqof || defined $op->[5]
$pos == $end
$seqof
defined $op->[5]
Truth table0%0/4
A and B or C
A= $pos == $endB= $seqofC= defined $op->[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | die "decode error"; | |||||||||||||||||||||||||||||||||||||||||
| 170 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 182 | my $extensions; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 182 | foreach my $cop (@{$op->[cCHILD]}) { | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 323 | ▶ | if ($tag eq $cop->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | my $nstash = $seqof | ||||||||||||||||||||||||||||||||||||||||||
| 177 | ? ($seqof->[$idx++]={}) | ||||||||||||||||||||||||||||||||||||||||||
| 178 | : defined($var) | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 157 | ▶ | ? ($stash->{$var}={}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | : ref($stash) eq 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 181 | ? ($$stash={}) : $stash; | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 157 | &{$decode[$cop->[cTYPE]]}( | |||||||||||||||||||||||||||||||||||||||||
| 184 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 185 | $cop, | ||||||||||||||||||||||||||||||||||||||||||
| 186 | $nstash, | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 157 | ▶ | ($cop->[cVAR] ? $nstash->{$cop->[cVAR]} : undef), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | $buf,$npos,$len,$larr, | ||||||||||||||||||||||||||||||||||||||||||
| 189 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 157 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 157 | ▶ | redo CHOICELOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$seqof and $pos < $end
MC/DC100%2/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table100%3/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 155 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 166 | ▶ | if ($cop->[cTYPE] == opEXTENSIONS) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | $extensions = 1; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 164 | ▶ | unless (length $cop->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | eval { | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 24 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 205 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 206 | [$cop], | ||||||||||||||||||||||||||||||||||||||||||
| 207 | (\my %tmp_stash), | ||||||||||||||||||||||||||||||||||||||||||
| 208 | $pos, | ||||||||||||||||||||||||||||||||||||||||||
| 209 | $npos+$len+$indef, | ||||||||||||||||||||||||||||||||||||||||||
| 210 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 211 | $larr, | ||||||||||||||||||||||||||||||||||||||||||
| 212 | $buf, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | my $nstash = $seqof | ||||||||||||||||||||||||||||||||||||||||||
| 216 | ? ($seqof->[$idx++]={}) | ||||||||||||||||||||||||||||||||||||||||||
| 217 | : defined($var) | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | ▶ | ? ($stash->{$var}={}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | : ref($stash) eq 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 220 | ? ($$stash={}) : $stash; | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 2 | @{$nstash}{keys %tmp_stash} = values %tmp_stash; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 24 | ▶ | } or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 22 | ▶ | die $@ if $@ =~ /nesting depth limit exceeded/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 227 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | ▶ | redo CHOICELOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seqof and $pos < $end
MC/DC50%1/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table66%2/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 140 | ▶ | if ($tag eq ($cop->[cTAG] | pack("C",ASN_CONSTRUCTOR)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tag eq ($cop->[0] | " ") and my $ctr = $ctr[$cop->[1]]
MC/DC0%0/2
$tag eq ($cop->[0] | " ") and my $ctr = $ctr[$cop->[1]]
$tag eq ($cop->[0] | " ")
my $ctr = $ctr[$cop->[1]]
Truth table33%1/3
A and B
A= $tag eq ($cop->[0] | " ")B= my $ctr = $ctr[$cop->[1]]
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | and my $ctr = $ctr[$cop->[cTYPE]]) | ||||||||||||||||||||||||||||||||||||||||||
| 238 | { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | my $nstash = $seqof | ||||||||||||||||||||||||||||||||||||||||||
| 240 | ? ($seqof->[$idx++]={}) | ||||||||||||||||||||||||||||||||||||||||||
| 241 | : defined($var) | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | ? ($stash->{$var}={}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | : ref($stash) eq 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 244 | ? ($$stash={}) : $stash; | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 247 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 248 | [$cop], | ||||||||||||||||||||||||||||||||||||||||||
| 249 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 250 | $npos, | ||||||||||||||||||||||||||||||||||||||||||
| 251 | $npos+$len, | ||||||||||||||||||||||||||||||||||||||||||
| 252 | (\my @ctrlist), | ||||||||||||||||||||||||||||||||||||||||||
| 253 | $larr, | ||||||||||||||||||||||||||||||||||||||||||
| 254 | $buf, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $nstash->{$cop->[cVAR]} = &{$ctr}(@ctrlist); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | redo CHOICELOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$seqof and $pos < $end
MC/DC0%0/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table0%0/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | ▶ | if ($pos < $end && $extensions) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$pos < $end and $extensions
MC/DC0%0/2
$pos < $end and $extensions
$pos < $end
$extensions
Truth table33%1/3
A and B
A= $pos < $endB= $extensions
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | $pos = $npos+$len+$indef; | |||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | redo CHOICELOOP if $seqof && $pos < $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqof and $pos < $end
MC/DC0%0/2
$seqof and $pos < $end
$seqof
$pos < $end
Truth table33%1/3
A and B
A= $seqofB= $pos < $end
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | next OP; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | die "decode error" unless $op->[cEXT]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | elsif ($op->[cTYPE] == opEXTENSIONS) { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 4 | $pos = $end; # Skip over the rest | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | die "this point should never be reached"; | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 598 | ▶ | die "decode error $pos $end" unless $pos == $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 26 | ▶ | sub _dec_boolean { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_boolean: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 26 | ▶ | $_[3] = unpack("C",substr($_[4],$_[5],1)) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 26 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 128 | ▶ | sub _dec_integer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_integer: called CC=10 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 128 | my $buf = substr($_[4],$_[5],$_[6]); | |||||||||||||||||||||||||||||||||||||||||
| 301 | 128 | ▶ | my $tmp = unpack("C",$buf) & 0x80 ? pack("C",255) : pack("C",0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 128 | ▶ | if ($_[6] > 4) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | my $max = ($_[0] && exists $_[0]->{decode_max_int_len}) | ||||||||||||||||||||||||||||||||||||||||||
| 304 | ? $_[0]->{decode_max_int_len} | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 28 | ▶ | : 1025; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[0] and exists $_[0]{"decode_max_int_len"}
MC/DC50%1/2
$_[0] and exists $_[0]{"decode_max_int_len"}
$_[0]
exists $_[0]{"decode_max_int_len"}
Truth table66%2/3
A and B
A= $_[0]B= exists $_[0]{"decode_max_int_len"}
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 28 | ▶ | die "decode: max_int_len must not be negative\n" if $max < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 27 | ▶ | die "INTEGER too large (length $_[6] exceeds max_int_len $max)\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max and $_[6] > $max
MC/DC100%2/2
$max and $_[6] > $max
$max
$_[6] > $max
Truth table100%3/3
A and B
A= $maxB= $_[6] > $max
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | if $max && $_[6] > $max; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 24 | ▶ | $_[3] = os2ip($buf, ($_[0] && $_[0]->{decode_bigint}) || 'Math::BigInt'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$_[0] && $_[0]{'decode_bigint'} || 'Math::BigInt'
$_[0] and $_[0]{"decode_bigint"}
MC/DC50%1/2
$_[0] && $_[0]{'decode_bigint'} || 'Math::BigInt'
$_[0]
$_[0]{"decode_bigint"}
Truth table66%2/3
A and B
A= $_[0]B= $_[0]{"decode_bigint"}
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # N unpacks an unsigned value | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 100 | $_[3] = unpack("l",pack("l",unpack("N", $tmp x (4-$_[6]) . $buf))); | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 124 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 535 | ▶ | sub _dec_bitstring { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_bitstring: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 535 | ▶ | if ($_[6] < 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 501 | $_[3] = ["", 0]; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 501 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 34 | ▶ | die "BIT STRING decode error\n" if unpack("C", substr($_[4],$_[5],1)) > 7; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 33 | $_[3] = [ substr($_[4],$_[5]+1,$_[6]-1), ($_[6]-1)*8-unpack("C",substr($_[4],$_[5],1)) ]; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 33 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 187 | ▶ | sub _dec_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 334 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 187 | $_[3] = substr($_[4],$_[5],$_[6]); | |||||||||||||||||||||||||||||||||||||||||
| 337 | 187 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | ▶ | sub _dec_null { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_null: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 343 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | ▶ | $_[3] = exists($_[0]->{decode_null}) ? $_[0]->{decode_null} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 174 | ▶ | sub _dec_object_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_object_id: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 352 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | # unpack "w" is quadratic in arc length, so bound each arc first | ||||||||||||||||||||||||||||||||||||||||||
| 355 | my $max = exists $_[0]->{decode_max_oid_arc_len} | ||||||||||||||||||||||||||||||||||||||||||
| 356 | ? $_[0]->{decode_max_oid_arc_len} | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 174 | ▶ | : 32; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 174 | ▶ | die "decode: max_oid_arc_len must not be negative\n" if $max < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 173 | ▶ | if ($max) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 172 | my $oid = substr($_[4],$_[5],$_[6]); | |||||||||||||||||||||||||||||||||||||||||
| 361 | # every byte of an arc except its last has the high bit set | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 172 | ▶ | while ($oid =~ /[\x80-\xff]+/g) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 95 | ▶ | die "OBJECT IDENTIFIER decode error (arc too large)\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | if $+[0] - $-[0] >= $max; | ||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 168 | my @data = unpack("w*",substr($_[4],$_[5],$_[6])); | |||||||||||||||||||||||||||||||||||||||||
| 369 | 168 | ▶ | if ($_[1]->[cTYPE] == opOBJID and @data > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[1][1] == 6 and @data > 1
MC/DC50%1/2
$_[1][1] == 6 and @data > 1
$_[1][1] == 6
@data > 1
Truth table66%2/3
A and B
A= $_[1][1] == 6B= @data > 1
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 165 | ▶ | if ($data[0] < 40) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 4 | splice(@data, 0, 1, 0, $data[0]); | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | elsif ($data[0] < 80) { | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 41 | splice(@data, 0, 1, 1, $data[0] - 40); | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 120 | splice(@data, 0, 1, 2, $data[0] - 80); | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 168 | $_[3] = join(".", @data); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 168 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 32 | my @_dec_real_base = (2,8,16); | |||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 13 | ▶ | sub _dec_real { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_real: called CC=12 SCAR=25.2
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 389 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 13 | ▶ | $_[3] = 0.0, return unless $_[6]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 11 | my $first = unpack("C",substr($_[4],$_[5],1)); | |||||||||||||||||||||||||||||||||||||||||
| 394 | 11 | ▶ | if ($first & 0x80) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | # A real number | ||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 9 | require POSIX; | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 9 | my $exp; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 9 | my $expLen = $first & 0x3; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 9 | my $estart = $_[5]+1; | |||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 9 | ▶ | if($expLen == 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 3 | $estart++; | |||||||||||||||||||||||||||||||||||||||||
| 405 | 3 | $expLen = unpack("C",substr($_[4],$_[5]+1,1)); | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 6 | $expLen++; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 9 | my $overhead = $estart - $_[5]; # 1 short-form, 2 long-form | |||||||||||||||||||||||||||||||||||||||||
| 412 | # an exponent over 4 bytes would become a bigint and make pow() run unbounded | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 9 | ▶ | die "REAL decode error\n" if $expLen > 4 || $expLen > $_[6] - $overhead; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$expLen > 4 or $expLen > $_[6] - $overhead
MC/DC100%2/2
$expLen > 4 or $expLen > $_[6] - $overhead
$expLen > 4
$expLen > $_[6] - $overhead
Truth table100%3/3
A or B
A= $expLen > 4B= $expLen > $_[6] - $overhead
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 7 | _dec_integer(undef, undef, undef, $exp, $_[4],$estart,$expLen); | |||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 7 | my $mant = 0.0; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 7 | for (reverse unpack("C*",substr($_[4],$estart+$expLen,$_[6]-$overhead-$expLen))) { | |||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | $exp +=8, $mant = (($mant+$_) / 256) ; | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | 7 | $mant *= 1 << (($first >> 2) & 0x3); | |||||||||||||||||||||||||||||||||||||||||
| 423 | 7 | ▶ | $mant = - $mant if $first & 0x40; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 7 | $_[3] = $mant * POSIX::pow($_dec_real_base[($first >> 4) & 0x3], $exp); | |||||||||||||||||||||||||||||||||||||||||
| 426 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | elsif($first & 0x40) { | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | ▶ | $_[3] = POSIX::HUGE_VAL(),return if $first == 0x40; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | ▶ | $_[3] = - POSIX::HUGE_VAL(),return if $first == 0x41; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||
| 432 | elsif(substr($_[4],$_[5],$_[6]) =~ /^.([-+]?)0*(\d+(?:\.\d+(?:[Ee][-+]?\d+)?)?)$/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $_[3] = eval "$1$2"; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | die "REAL decode error\n"; | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 30 | ▶ | sub _dec_explicit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_explicit: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | # 0 1 2 3 4 5 6 7 | ||||||||||||||||||||||||||||||||||||||||||
| 443 | # $optn, $op, $stash, $var, $buf, $pos, $len, $larr | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 30 | ▶ | local $_[1][cCHILD][0][cVAR] = $_[1][cVAR] unless $_[1][cCHILD][0][cVAR]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 30 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 448 | $_[0], #optn | ||||||||||||||||||||||||||||||||||||||||||
| 449 | $_[1]->[cCHILD], #ops | ||||||||||||||||||||||||||||||||||||||||||
| 450 | $_[2], #stash | ||||||||||||||||||||||||||||||||||||||||||
| 451 | $_[5], #pos | ||||||||||||||||||||||||||||||||||||||||||
| 452 | $_[5]+$_[6], #end | ||||||||||||||||||||||||||||||||||||||||||
| 453 | undef, #loop | ||||||||||||||||||||||||||||||||||||||||||
| 454 | $_[7], | ||||||||||||||||||||||||||||||||||||||||||
| 455 | $_[4], #buf | ||||||||||||||||||||||||||||||||||||||||||
| 456 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 402 | ▶ | sub _dec_sequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_sequence: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | # 0 1 2 3 4 5 6 7 | ||||||||||||||||||||||||||||||||||||||||||
| 461 | # $optn, $op, $stash, $var, $buf, $pos, $len, $larr | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 402 | ▶ | if (defined( my $ch = $_[1]->[cCHILD])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 402 | ▶ | _decode( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
defined $_[3] or $_[1][3]
$_[1][3] && ($_[3] = [])
MC/DC100%2/2
defined $_[3] or $_[1][3]
defined $_[3]
$_[1][3]
MC/DC100%1/1
$_[1][3] && ($_[3] = [])
$_[1][3]
Truth table100%3/3
A or B
A= defined $_[3]B= $_[1][3]
Truth table100%2/2
A
A= $_[1][3]
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | $_[0], #optn | ||||||||||||||||||||||||||||||||||||||||||
| 466 | $ch, #ops | ||||||||||||||||||||||||||||||||||||||||||
| 467 | (defined($_[3]) || $_[1]->[cLOOP]) ? $_[2] : ($_[3]= {}), #stash | ||||||||||||||||||||||||||||||||||||||||||
| 468 | $_[5], #pos | ||||||||||||||||||||||||||||||||||||||||||
| 469 | $_[5]+$_[6], #end | ||||||||||||||||||||||||||||||||||||||||||
| 470 | $_[1]->[cLOOP] && ($_[3]=[]), #loop | ||||||||||||||||||||||||||||||||||||||||||
| 471 | $_[7], | ||||||||||||||||||||||||||||||||||||||||||
| 472 | $_[4], #buf | ||||||||||||||||||||||||||||||||||||||||||
| 473 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 475 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $_[3] = substr($_[4],$_[5],$_[6]); | |||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | 399 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 8 | ▶ | sub _dec_set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_set: called CC=34 SCAR=51.7
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | # 0 1 2 3 4 5 6 7 | ||||||||||||||||||||||||||||||||||||||||||
| 484 | # $optn, $op, $stash, $var, $buf, $pos, $len, $larr | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | # decode SET OF the same as SEQUENCE OF | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 8 | my $ch = $_[1]->[cCHILD]; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 8 | ▶ | goto &_dec_sequence if $_[1]->[cLOOP] or !defined($ch); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[1][3] or not defined $ch
MC/DC0%0/2
$_[1][3] or not defined $ch
$_[1][3]
not defined $ch
Truth table33%1/3
A or not(B)
A= $_[1][3]B= not defined $ch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 8 | my ($optn, $pos, $larr) = @_[0,5,7]; | |||||||||||||||||||||||||||||||||||||||||
| 491 | 8 | ▶ | my $stash = defined($_[3]) ? $_[2] : ($_[3]={}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 8 | my $end = $pos + $_[6]; | |||||||||||||||||||||||||||||||||||||||||
| 493 | 8 | my @done; | |||||||||||||||||||||||||||||||||||||||||
| 494 | my $extensions; | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 8 | ▶ | while ($pos < $end) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 26 | ▶ | my($tag,$len,$npos,$indef) = _decode_tl($_[4],$pos,$end,$larr) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | or die "decode error"; | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | 26 | my ($idx, $any, $done) = (-1); | |||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | SET_OP: | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 26 | foreach my $op (@$ch) { | |||||||||||||||||||||||||||||||||||||||||
| 504 | 69 | $idx++; | |||||||||||||||||||||||||||||||||||||||||
| 505 | 69 | ▶ | if (length($op->[cTAG])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 55 | ▶ | if ($tag eq $op->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | 25 | my $var = $op->[cVAR]; | |||||||||||||||||||||||||||||||||||||||||
| 508 | 25 | &{$decode[$op->[cTYPE]]}( | |||||||||||||||||||||||||||||||||||||||||
| 509 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 510 | $op, | ||||||||||||||||||||||||||||||||||||||||||
| 511 | $stash, | ||||||||||||||||||||||||||||||||||||||||||
| 512 | # We send 1 if there is not var as if there is the decode | ||||||||||||||||||||||||||||||||||||||||||
| 513 | # should be getting undef. So if it does not get undef | ||||||||||||||||||||||||||||||||||||||||||
| 514 | # it knows it has no variable | ||||||||||||||||||||||||||||||||||||||||||
| 515 | 25 | ▶ | (defined($var) ? $stash->{$var} : 1), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | $_[4],$npos,$len,$larr, | ||||||||||||||||||||||||||||||||||||||||||
| 517 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 25 | $done = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 25 | last SET_OP; | |||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 30 | ▶ | if ($tag eq ($op->[cTAG] | pack("C",ASN_CONSTRUCTOR)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tag eq ($op->[0] | " ") and my $ctr = $ctr[$op->[1]]
MC/DC0%0/2
$tag eq ($op->[0] | " ") and my $ctr = $ctr[$op->[1]]
$tag eq ($op->[0] | " ")
my $ctr = $ctr[$op->[1]]
Truth table33%1/3
A and B
A= $tag eq ($op->[0] | " ")B= my $ctr = $ctr[$op->[1]]
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | and my $ctr = $ctr[$op->[cTYPE]]) | ||||||||||||||||||||||||||||||||||||||||||
| 523 | { | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 525 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 526 | [$op], | ||||||||||||||||||||||||||||||||||||||||||
| 527 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 528 | $npos, | ||||||||||||||||||||||||||||||||||||||||||
| 529 | $npos+$len, | ||||||||||||||||||||||||||||||||||||||||||
| 530 | (\my @ctrlist), | ||||||||||||||||||||||||||||||||||||||||||
| 531 | $larr, | ||||||||||||||||||||||||||||||||||||||||||
| 532 | $_[4], | ||||||||||||||||||||||||||||||||||||||||||
| 533 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | $stash->{$op->[cVAR]} = &{$ctr}(@ctrlist) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | if defined $op->[cVAR]; | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $done = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | last SET_OP; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 30 | next SET_OP; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | elsif ($op->[cTYPE] == opANY) { | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $any = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 545 | elsif ($op->[cTYPE] == opCHOICE) { | ||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | my $var = $op->[cVAR]; | |||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | foreach my $cop (@{$op->[cCHILD]}) { | |||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if ($tag eq $cop->[cTAG]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | my $nstash = defined($var) ? ($stash->{$var}={}) : $stash; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | &{$decode[$cop->[cTYPE]]}( | |||||||||||||||||||||||||||||||||||||||||
| 552 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 553 | $cop, | ||||||||||||||||||||||||||||||||||||||||||
| 554 | $nstash, | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $nstash->{$cop->[cVAR]}, | |||||||||||||||||||||||||||||||||||||||||
| 556 | $_[4],$npos,$len,$larr, | ||||||||||||||||||||||||||||||||||||||||||
| 557 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $done = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | last SET_OP; | |||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | if ($tag eq ($cop->[cTAG] | pack("C",ASN_CONSTRUCTOR)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag eq ($cop->[0] | " ") and my $ctr = $ctr[$cop->[1]]
MC/DC0%0/2
$tag eq ($cop->[0] | " ") and my $ctr = $ctr[$cop->[1]]
$tag eq ($cop->[0] | " ")
my $ctr = $ctr[$cop->[1]]
Truth table0%0/3
A and B
A= $tag eq ($cop->[0] | " ")B= my $ctr = $ctr[$cop->[1]]
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | and my $ctr = $ctr[$cop->[cTYPE]]) | ||||||||||||||||||||||||||||||||||||||||||
| 563 | { | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | my $nstash = defined($var) ? ($stash->{$var}={}) : $stash; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | _decode( | |||||||||||||||||||||||||||||||||||||||||
| 567 | $optn, | ||||||||||||||||||||||||||||||||||||||||||
| 568 | [$cop], | ||||||||||||||||||||||||||||||||||||||||||
| 569 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 570 | $npos, | ||||||||||||||||||||||||||||||||||||||||||
| 571 | $npos+$len, | ||||||||||||||||||||||||||||||||||||||||||
| 572 | (\my @ctrlist), | ||||||||||||||||||||||||||||||||||||||||||
| 573 | $larr, | ||||||||||||||||||||||||||||||||||||||||||
| 574 | $_[4], | ||||||||||||||||||||||||||||||||||||||||||
| 575 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $nstash->{$cop->[cVAR]} = &{$ctr}(@ctrlist); | |||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $done = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | last SET_OP; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||
| 583 | elsif ($op->[cTYPE] == opEXTENSIONS) { | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 14 | $extensions = $idx; | |||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 586 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | die "internal error"; | |||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | 26 | ▶ | if (!defined($done) and defined($any)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $done and defined $any
MC/DC0%0/2
not defined $done and defined $any
not defined $done
defined $any
Truth table66%2/3
not(A) and B
A= not defined $doneB= defined $any
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | my $var = $ch->[$any][cVAR]; | |||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | $stash->{$var} = substr($_[4],$pos,$len+$npos-$pos) if defined $var; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $done = $any; | |||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 26 | ▶ | if( !defined($done) && defined($extensions) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $done and defined $extensions
MC/DC50%1/2
not defined $done and defined $extensions
not defined $done
defined $extensions
Truth table66%2/3
not(A) and B
A= not defined $doneB= defined $extensions
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 1 | $done = $extensions; | |||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 26 | ▶ | die "decode error" if !defined($done) or $done[$done]++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $done or $done[$done]++
MC/DC0%0/2
not defined $done or $done[$done]++
not defined $done
$done[$done]++
Truth table33%1/3
not(A) or B
A= not defined $doneB= $done[$done]++
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 26 | $pos = $npos + $len + $indef; | |||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 8 | ▶ | die "decode error" unless $end == $pos; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 8 | foreach my $idx (0..$#{$ch}) { | |||||||||||||||||||||||||||||||||||||||||
| 609 | 30 | ▶ | die "decode error" unless $done[$idx] or $ch->[$idx][cEXT] or $ch->[$idx][cTYPE] == opEXTENSIONS; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$done[$idx] or $ch->[$idx][5] or $ch->[$idx][1] == 18
$done[$idx] or $ch->[$idx][5]
MC/DC0%0/3
$done[$idx] or $ch->[$idx][5] or $ch->[$idx][1] == 18
$done[$idx]
$ch->[$idx][5]
$ch->[$idx][1] == 18
Truth table75%3/4
A or B or C
A= $done[$idx]B= $ch->[$idx][5]C= $ch->[$idx][1] == 18
| |||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 32 | my %_dec_time_opt = ( unixtime => 0, withzone => 1, raw => 2); | |||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | 44 | ▶ | sub _dec_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_time: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 620 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 44 | ▶ | my $mode = $_dec_time_opt{$_[0]->{'decode_time'} || ''} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$_dec_time_opt{$_[0]{'decode_time'} or ''} || 0
$_[0]{'decode_time'} || ''
MC/DC100%1/1
$_dec_time_opt{$_[0]{'decode_time'} or ''} || 0
$_dec_time_opt{$_[0]{'decode_time'} or ''}
MC/DC100%1/1
$_[0]{'decode_time'} || ''
$_[0]{'decode_time'}
Truth table100%2/2
A
A= $_dec_time_opt{$_[0]{'decode_time'} or ''}
Truth table100%2/2
A
A= $_[0]{'decode_time'}
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | 44 | ▶ | if ($mode == 2 or $_[6] == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$mode == 2 or $_[6] == 0
MC/DC50%1/2
$mode == 2 or $_[6] == 0
$mode == 2
$_[6] == 0
Truth table66%2/3
A or B
A= $mode == 2B= $_[6] == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 625 | 10 | $_[3] = substr($_[4],$_[5],$_[6]); | |||||||||||||||||||||||||||||||||||||||||
| 626 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 34 | ▶ | my @bits = (substr($_[4],$_[5],$_[6]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | =~ /^((?:\d\d)?\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)((?:\.\d{1,3})?)(([-+])(\d\d)(\d\d)|Z)/) | ||||||||||||||||||||||||||||||||||||||||||
| 631 | or die "bad time format"; | ||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | # two digit year (UTCTime), RFC 5280 4.1.2.5.1: 50 - 99 is 19YY, 00 - 49 is 20YY | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 34 | ▶ | if (length $bits[0] == 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 635 | 25 | ▶ | $bits[0] += ($bits[0] < 50) ? 2000 : 1900; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | 34 | $bits[1] -= 1; | |||||||||||||||||||||||||||||||||||||||||
| 638 | 34 | require Time::Local; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 34 | my $time = Time::Local::timegm_modern(@bits[5,4,3,2,1,0]); | |||||||||||||||||||||||||||||||||||||||||
| 640 | 34 | ▶ | $time += $bits[6] if length $bits[6]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 34 | my $offset = 0; | |||||||||||||||||||||||||||||||||||||||||
| 642 | 34 | ▶ | if ($bits[7] ne 'Z') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 643 | 5 | $offset = $bits[9] * 3600 + $bits[10] * 60; | |||||||||||||||||||||||||||||||||||||||||
| 644 | 5 | ▶ | $offset = -$offset if $bits[8] eq '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 5 | $time -= $offset; | |||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 34 | ▶ | $_[3] = $mode ? [$time,$offset] : $time; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | 2 | ▶ | sub _dec_utf8 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_utf8: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 653 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 32 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 656 | 32 | unless (CHECK_UTF8) { | |||||||||||||||||||||||||||||||||||||||||
| 657 | local $SIG{__DIE__}; | ||||||||||||||||||||||||||||||||||||||||||
| 658 | eval { require bytes } and 'bytes'->unimport; | ||||||||||||||||||||||||||||||||||||||||||
| 659 | eval { require utf8 } and 'utf8'->import; | ||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | 2 | if (CHECK_UTF8) { | |||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | $_[3] = Encode::decode('utf8', substr($_[4],$_[5],$_[6])); | |||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||
| 666 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 667 | $_[3] = (substr($_[4],$_[5],$_[6]) =~ /(.*)/s)[0]; | ||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | 1754 | ▶ | sub _decode_tl { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_tl: called CC=13 SCAR=25.8
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | 1754 | my($pos,$end,$larr) = @_[1,2,3]; | |||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | 1754 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | 1729 | my $indef = 0; | |||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 1729 | my $tag = substr($_[0], $pos++, 1); | |||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | 1729 | ▶ | if((unpack("C",$tag) & 0x1f) == 0x1f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | my $b; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 1 | my $n=1; | |||||||||||||||||||||||||||||||||||||||||
| 686 | 1 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 687 | 5 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | 4 | $tag .= substr($_[0],$pos++,1); | |||||||||||||||||||||||||||||||||||||||||
| 689 | 4 | $b = ord substr($tag,-1); | |||||||||||||||||||||||||||||||||||||||||
| 690 | } while($b & 0x80); | ||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | 1728 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 1728 | my $len = ord substr($_[0],$pos++,1); | |||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | 1728 | ▶ | if($len & 0x80) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | 141 | $len &= 0x7f; | |||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 141 | ▶ | if ($len) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 131 | ▶ | return if $pos+$len > $end ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | 131 | ▶ | my $padding = $len < 4 ? "\0" x (4 - $len) : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | 131 | ($len,$pos) = (unpack("N", $padding . substr($_[0],$pos,$len)), $pos+$len); | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 10 | ▶ | unless (exists $larr->{$pos}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 5 | ▶ | _scan_indef($_[0],$pos,$end,$larr) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||
| 709 | 9 | $indef = 2; | |||||||||||||||||||||||||||||||||||||||||
| 710 | 9 | $len = $larr->{$pos}; | |||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 1727 | ▶ | return if $pos+$len+$indef > $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | # return the tag, the length of the data, the position of the data | ||||||||||||||||||||||||||||||||||||||||||
| 717 | # and the number of extra bytes for indefinite encoding | ||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | 1727 | ($tag, $len, $pos, $indef); | |||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 5 | ▶ | sub _scan_indef { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scan_indef: called CC=13 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||
| 723 | 5 | my($pos,$end,$larr) = @_[1,2,3]; | |||||||||||||||||||||||||||||||||||||||||
| 724 | 5 | my @depth = ( $pos ); | |||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||
| 726 | 5 | ▶ | while(@depth) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 727 | 27 | ▶ | return if $pos+2 > $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | 27 | ▶ | if (substr($_[0],$pos,2) eq "\0\0") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | 10 | my $end = $pos; | |||||||||||||||||||||||||||||||||||||||||
| 731 | 10 | my $stref = shift @depth; | |||||||||||||||||||||||||||||||||||||||||
| 732 | # replace pos with length = end - pos | ||||||||||||||||||||||||||||||||||||||||||
| 733 | 10 | $larr->{$stref} = $end - $stref; | |||||||||||||||||||||||||||||||||||||||||
| 734 | 10 | $pos += 2; | |||||||||||||||||||||||||||||||||||||||||
| 735 | 10 | next; | |||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||
| 737 | 17 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | 17 | my $tag = substr($_[0], $pos++, 1); | |||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 17 | ▶ | if((unpack("C",$tag) & 0x1f) == 0x1f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 1 | my $b; | |||||||||||||||||||||||||||||||||||||||||
| 743 | 1 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 3 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | 2 | $tag .= substr($_[0],$pos++,1); | |||||||||||||||||||||||||||||||||||||||||
| 746 | 2 | $b = ord substr($tag,-1); | |||||||||||||||||||||||||||||||||||||||||
| 747 | } while($b & 0x80); | ||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | 16 | ▶ | return if $pos >= $end; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 16 | my $len = ord substr($_[0],$pos++,1); | |||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | 16 | ▶ | if($len & 0x80) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | 6 | ▶ | if ($len &= 0x7f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | return if $pos+$len > $end ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | my $padding = $len < 4 ? "\0" x (4 - $len) : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | $pos += $len + unpack("N", $padding . substr($_[0],$pos,$len)); | |||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||
| 760 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 761 | # reserve another list element | ||||||||||||||||||||||||||||||||||||||||||
| 762 | 6 | unshift @depth, $pos; | |||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||
| 765 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 766 | 10 | $pos += $len; | |||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||
| 770 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | 1 | ▶ | sub _ctr_string { join '', @_ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ctr_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | 1 | ▶ | sub _ctr_bitstring { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ctr_bitstring: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 1 | [ join('', map { $_->[0] } @_), $_[-1]->[1] ] | |||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | 8 | ▶ | sub _dec_bcd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dec_bcd: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 780 | # 0 1 2 3 4 5 6 | ||||||||||||||||||||||||||||||||||||||||||
| 781 | # $optn, $op, $stash, $var, $buf, $pos, $len | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | 8 | ($_[3] = unpack("H*", substr($_[4],$_[5],$_[6]))) =~ s/[fF]$//; | |||||||||||||||||||||||||||||||||||||||||
| 784 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | 32 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||