Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Convert-ASN1 CPAN distribution.

Report information
The Basics
Id: 34882
Status: rejected
Priority: 0/
Queue: Convert-ASN1

People
Owner: Nobody in particular
Requestors: grey.leo [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Cutted zeroes in many included indefinite structures
Date: Fri, 11 Apr 2008 19:27:43 +0400
To: bug-Convert-ASN1 [...] rt.cpan.org
From: "Leo Cherepanov" <grey.leo [...] gmail.com>
Hi. I have a file with structure Sequence (indefinite){ OBJECT IDENTIFIER, Tag [0] (indefinite){ Sequence (indefinite){ ... Sequence (indefinite){ ... Tag [0] (indefinite){...} } } } } It has 5 "indefinites" - so 10 zero bytes at end of file. Parsing by ASN code A ::= SEQUENCE { i OBJECT IDENTIFIER, b [0] EXPLICIT ANY } I have only 4 zero bytes at end of "b", so one "indefinite" (two zero bytes) is missed. I've attach an example file. Fix it, please :) Thanx a lot!
Download cpro.der
application/x-x509-ca-cert 1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #34882] Cutted zeroes in many included indefinite structures
Date: Fri, 11 Apr 2008 11:01:58 -0500
To: bug-Convert-ASN1 [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
As bug reports go yours is not very useful. Are you trying to read the attached file or are you trying to parse it ? A small example perl script that demonstrates the problem would help a lot in seeing all the inputs and the outputs so I can at least identify where the problem is. You also did not state which version you are using. Are you sure you are running the latest released on CPAN Graham.
Subject: Re: [rt.cpan.org #34882] Cutted zeroes in many included indefinite structures
Date: Fri, 11 Apr 2008 23:31:27 +0400
To: bug-Convert-ASN1 [...] rt.cpan.org
From: "Leo Cherepanov" <grey.leo [...] gmail.com>
Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=34882 > > > As bug reports go yours is not very useful.
Sorry Show quoted text
> Are you trying to read the attached file or are you trying to parse it ?
Parse :) Show quoted text
> A small example perl script that demonstrates the problem would help > a lot in seeing all the inputs and the outputs so I can at least > identify where the problem is.
OK, I've tried to make it more abstract, but probably I was wrong. Show quoted text
> You also did not state which version you are using. Are you sure you > are running the latest released on CPAN
I've just upgraded to latest 0.21 Well, my try #2. You can see example file has ten zero bytes at the end (remember for future !) And file begins with (in hex) 3080 0609 2A 86 48 86 F7 0D 01 07 03 A080 3080 ... So it has sequence (30) indefinite (80), after that - object identifier (0609 2A 86 48 86 F7 0D 01 07 03), then - Tag [0] field (A0) indefinite (80), then indef.seq. (3080) again. Some code (test.pl) use Data::Dumper; use Convert::ASN1; binmode(STDOUT); local $/; my $asn = Convert::ASN1->new; $asn->prepare('A ::= SEQUENCE { oid OBJECT IDENTIFIER, s [0] EXPLICIT ANY} B ::= SEQUENCE OF ANY'); my $d = $asn->find('A')->decode(<>); print Dumper($d); print Dumper($asn->find('B')->decode($d->{'s'})); Use "test.pl cpro.der > dump" and look into dump (hex view). Second Dumper prints undef. And it is easy to say why - look at the end of field "s" in first Dumper. I has only 4 zero bytes. But (do remember?!) we have had 10 zero bytes at the end of original file. Parsing type A we "open" 2 "containers" - first sequence and second tag[0] - it must be 10-4=6 zero bytes at the end of "s". Moreover, look at output of $asn->prepare('A ::= SEQUENCE { oid OBJECT IDENTIFIER, s [0] EXPLICIT SEQUENCE OF ANY}'); print Dumper( $asn->find('A')->decode(<>) ); - it prints normally parsed sequence in "s" ! I hope I've write a bit better :) Sorry if I've messed you again, please ask anything - I'll try my best. Thanx!