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