diff options
author | Björn Gustavsson <[email protected]> | 2013-02-28 11:42:47 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-05-31 14:52:16 +0200 |
commit | 902b51b8b43fe66fd4488c7fa10c05c3b9da59b4 (patch) | |
tree | 8010da4c1a8791648959839defc53e49c59cd5aa /lib/erl_interface/priv | |
parent | 649114be27c1893bb1624ec02e2948ae4a7332c7 (diff) | |
download | otp-902b51b8b43fe66fd4488c7fa10c05c3b9da59b4.tar.gz otp-902b51b8b43fe66fd4488c7fa10c05c3b9da59b4.tar.bz2 otp-902b51b8b43fe66fd4488c7fa10c05c3b9da59b4.zip |
PER/UPER: Correct encoding of a length outside the root range
Consider a type with a size constraint with an extension marker
such as:
S ::= OCTET STRING (SIZE (0..10, ...))
For a length outside the root range (e.g. 42), the PER/UPER encoder
will encode the length field in the same way as it would the type
INTEGER (0..MAX) (i.e., as semi-constrained whole number), while the
decoder would decode the length in the same way as length field
without any constraint.
Clearly, either the encoder or the decoder is wrong. But which one?
Dubuisson's [1] book (page 442) says that the length should be encoded
as a semi-constrained whole number if the length is outside the root
range.
The X.691 standard document [2] also says (e.g. in 15.11) that length
fields should be a semi-constrained number, but gives a reference
to section gives a reference to section 10.9, "General rules for encoding
a length determinant", and not to to 10.7, "Encoding of a
semi-constrained whole number".
Reading the standard that way should imply that a length outside the
root range should be encoded in the same way as an unconstrained
length, and that the decoder does the right thing.
Further support for that interpretation:
- Larmouth's book [3], page 303.
- The ASN.1 playground. [4]
References:
[1] http://www.oss.com/asn1/resources/books-whitepapers-pubs/dubuisson-asn1-book.PDF
[2] http://www.itu.int/ITU-T/studygroups/com17/languages/X.691-0207.pdf
[3] http://www.oss.com/asn1/resources/books-whitepapers-pubs/larmouth-asn1-book.pdf
[4] http://asn1-playground.oss.com
Diffstat (limited to 'lib/erl_interface/priv')
0 files changed, 0 insertions, 0 deletions