diff options
author | Björn Gustavsson <[email protected]> | 2014-09-29 12:55:21 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-09-29 13:19:43 +0200 |
commit | 62bab9a7a2adbe3f1b7960a35d7dab1d7119c639 (patch) | |
tree | c9c5e56c1dd5fc3c8435f816d0fc05f7325f17c6 /lib/asn1/test/ber_decode_error.erl | |
parent | 2397a14d1113bc2d334dee908269cf3b63c46314 (diff) | |
download | otp-62bab9a7a2adbe3f1b7960a35d7dab1d7119c639.tar.gz otp-62bab9a7a2adbe3f1b7960a35d7dab1d7119c639.tar.bz2 otp-62bab9a7a2adbe3f1b7960a35d7dab1d7119c639.zip |
BER decoding: Don't allow primitives with indefinite lengths
According to the BER encoding rules, only constructed values may
have indefinite lengths. A primitive value must be encoded with
a definite length.
Reported-by: Simon Cornish
Diffstat (limited to 'lib/asn1/test/ber_decode_error.erl')
-rw-r--r-- | lib/asn1/test/ber_decode_error.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/asn1/test/ber_decode_error.erl b/lib/asn1/test/ber_decode_error.erl index 6fd2450c62..ef11717c45 100644 --- a/lib/asn1/test/ber_decode_error.erl +++ b/lib/asn1/test/ber_decode_error.erl @@ -61,6 +61,10 @@ run([]) -> (catch 'Constructed':decode('S', sub(<<40,16#80,1,1,255,0,0>>, 6))), {error,{asn1,{invalid_length,_}}} = (catch 'Constructed':decode('S', sub(<<40,16#80,1,1,255,0,0>>, 5))), + + %% A primitive must not be encoded with an indefinite length. + {error,{asn1,{invalid_length,_}}} = + (catch 'Constructed':decode('OS', <<4,128,4,3,97,98,99,0,0>>)), ok. sub(Bin, Bytes) -> |