[esnacc-dev] [PATCH] compiler/core/snacc: Support optional sequences with asnextension

Aaron Conole aconole at redhat.com
Fri Jul 15 16:11:43 UTC 2016


Hanspeter Halle <hphalle at t-online.de> writes:
>
> We discovered a decoding error when getting an empty sequence for a sequence
> definition consisting of only optional elements and an extension marker. In
> this case the decoder tries to read the first tag even if the sequence length
> is zero. An example ASN1 definition would be:
>
> Aa ::= SEQUENCE {
>
>     bb SEQUENCE {
>
>         cc OCTET STRING OPTIONAL,
>         dd INTEGER OPTIONAL,
>         ...
>     }
>
> }
>
> The generated decoder starts with
>
> void AaSeq::BDecContent (const AsnBuf &_b, AsnTag /*tag0*/, AsnLen elmtLen0,
> AsnLen &bytesDecoded)
> {
>   FUNC(" AaSeq::BDecContent");
>   Clear();
>   AsnTag tag1 = AsnTag();
>   AsnLen seqBytesDecoded = 0;
>   AsnLen elmtLen1 = 0;
>   tag1 = BDecTag (_b, seqBytesDecoded);
>
>   ...
>
> which is obviously wrong.

Patch applied to master.  Thanks for your contribution.



More information about the dev mailing list