[erlang-bugs] ASN.1 encoder does not check constraint
Maxim Treskin
zerthurd@REDACTED
Fri Jul 10 09:33:18 CEST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20090710/375ccce3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StructA.asn
Type: chemical/x-ncbi-asn1
Size: 179 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20090710/375ccce3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StructB.asn
Type: chemical/x-ncbi-asn1
Size: 156 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20090710/375ccce3/attachment-0001.bin>
More information about the erlang-bugs
mailing list