[erlang-bugs] ASN.1 encoder does not check constraint

Niclas Eklund <>
Tue Jul 14 11:12:57 CEST 2009


Hello!

Thanks for reporting this!

/Niclas @ Erlang/OTP


On Fri, 10 Jul 2009, Maxim Treskin wrote:

> Hello
> I found situation when ASN.1 runtime encoder does not check constraint:
>
> The Number defined in StructA.asn as:
>
> Number    ::= OCTET STRING (SIZE(minNumberLength..maxNumberLength))
> minNumberLength     INTEGER ::= 1
> maxNumberLength INTEGER ::= 5
>
>
> Then in StructB.asn Number is imported, and used as:
>
> Data ::= SEQUENCE
> {
>  version      [0] INTEGER,
>  number       [1] Number
> }
>
> So, after compilation of this two asn-files we have encoder module for
> StructB, but this encoder does not check Number size constraint:
>
> 1> 'StructB':encode('Data', {'Data', 1, "34"}).
> {ok,[48,7,128,1,1,129,2,51,52]}
> 2> 'StructB':encode('Data', {'Data', 1, ""}).
> {ok,[48,5,128,1,1,129,0]}
> 3> 'StructB':encode('Data', {'Data', 1, "3444455555554"}).
> {ok,[48,18,128,1,1,129,13,51,52,52,52,52,53,53,53,53,53,53, 53,52]}
>
>
> Thank you
>
> -- 
> Maxim Treskin
>




More information about the erlang-bugs mailing list