aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1rtt_uper.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2013-03-13 15:50:57 +0100
committerErlang/OTP <[email protected]>2013-03-13 15:50:57 +0100
commitdf291bae520a2fdd404172fdffaaf040fd939151 (patch)
tree55dc869234e3ba8c27a8cf627395465468941013 /lib/asn1/src/asn1rtt_uper.erl
parentcda401b58a3db7213eb14197680d401fd1399de9 (diff)
parent5588449531f1a41d05e5d2d4fe5976db643a18e3 (diff)
downloadotp-df291bae520a2fdd404172fdffaaf040fd939151.tar.gz
otp-df291bae520a2fdd404172fdffaaf040fd939151.tar.bz2
otp-df291bae520a2fdd404172fdffaaf040fd939151.zip
Merge branch 'bjorn/asn1/per-decode/OTP-10916' into maint-r16
* bjorn/asn1/per-decode/OTP-10916: PER: Ensure that the complete encoding is at least one byte PER/UPER: Correct decoding of ENUMERATEDs with a single value
Diffstat (limited to 'lib/asn1/src/asn1rtt_uper.erl')
-rw-r--r--lib/asn1/src/asn1rtt_uper.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1rtt_uper.erl b/lib/asn1/src/asn1rtt_uper.erl
index ad0678f3c3..8efe9a7b0f 100644
--- a/lib/asn1/src/asn1rtt_uper.erl
+++ b/lib/asn1/src/asn1rtt_uper.erl
@@ -1016,8 +1016,11 @@ complete(InList) when is_list(InList) ->
Bits -> <<Res/bitstring,0:(8-Bits)>>
end
end;
-complete(InList) when is_binary(InList) ->
- InList;
+complete(Bin) when is_binary(Bin) ->
+ case Bin of
+ <<>> -> <<0>>;
+ _ -> Bin
+ end;
complete(InList) when is_bitstring(InList) ->
PadLen = 8 - (bit_size(InList) band 7),
<<InList/bitstring,0:PadLen>>.