diff options
Diffstat (limited to 'lib/asn1')
-rw-r--r-- | lib/asn1/doc/src/notes.xml | 21 | ||||
-rw-r--r-- | lib/asn1/src/asn1ct_imm.erl | 10 | ||||
-rw-r--r-- | lib/asn1/src/asn1rtt_per.erl | 5 | ||||
-rw-r--r-- | lib/asn1/src/asn1rtt_uper.erl | 7 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/PartialDecSeq.asn1config | 8 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/Prim.asn1 | 13 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/testobj.erl | 2 | ||||
-rw-r--r-- | lib/asn1/test/testPrim.erl | 8 | ||||
-rw-r--r-- | lib/asn1/vsn.mk | 2 |
9 files changed, 59 insertions, 17 deletions
diff --git a/lib/asn1/doc/src/notes.xml b/lib/asn1/doc/src/notes.xml index 4d4600b3ab..e619408591 100644 --- a/lib/asn1/doc/src/notes.xml +++ b/lib/asn1/doc/src/notes.xml @@ -31,6 +31,27 @@ <p>This document describes the changes made to the asn1 application.</p> +<section><title>Asn1 2.0.1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>The generated decoder for the 'per' and 'uper' + backends did not correctly decode ENUMERATEDs with a + single value.</p> + <p>The generated encoder for the 'per' and 'uper' + backends generated an empty binary for a top-level type + that did not need to be encoded (such as an ENUMERATED + with a single value). The correct result should be a + binary containing a 0 byte.</p> + <p> + Own Id: OTP-10916 Aux Id: seq12270 </p> + </item> + </list> + </section> + +</section> + <section><title>Asn1 2.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl index 869bda5d52..4b2c3b1b65 100644 --- a/lib/asn1/src/asn1ct_imm.erl +++ b/lib/asn1/src/asn1ct_imm.erl @@ -61,6 +61,8 @@ optimize_alignment(Imm, Al) -> per_dec_boolean() -> {map,{get_bits,1,[1]},[{0,false},{1,true}]}. +per_dec_enumerated([{V,_}], _Aligned) -> + {value,V}; per_dec_enumerated(NamedList0, Aligned) -> Ub = length(NamedList0) - 1, Constraint = [{'ValueRange',{0,Ub}}], @@ -375,6 +377,8 @@ opt_al({call,Fun,E0}, A0) -> opt_al({convert,Op,E0}, A0) -> {E,A} = opt_al(E0, A0), {{convert,Op,E},A}; +opt_al({value,V}=Term, A) when is_integer(V); is_atom(V) -> + {Term,A}; opt_al({value,E0}, A0) -> {E,A} = opt_al(E0, A0), {{value,E},A}; @@ -391,8 +395,6 @@ opt_al({'case',Cs0}, A0) -> opt_al({map,E0,Cs}, A0) -> {E,A} = opt_al(E0, A0), {{map,E,Cs},A}; -opt_al('NULL'=Null, A) -> - {Null,A}; opt_al(I, A) when is_integer(I) -> {I,A}. @@ -480,8 +482,8 @@ flatten({map,E0,Cs0}, Buf0, St0) -> {Dst,St2} = new_var("Int", St1), Cs = flatten_map_cs(Cs0, E), {{Dst,DstBuf},Pre++[{'map',E,Cs,{Dst,DstBuf}}],St2}; -flatten({value,'NULL'}, Buf0, St0) -> - {{"'NULL'",Buf0},[],St0}; +flatten({value,V}, Buf0, St0) when is_atom(V) -> + {{"'"++atom_to_list(V)++"'",Buf0},[],St0}; flatten({value,V0}, Buf0, St0) when is_integer(V0) -> {{V0,Buf0},[],St0}; flatten({value,V0}, Buf0, St0) -> diff --git a/lib/asn1/src/asn1rtt_per.erl b/lib/asn1/src/asn1rtt_per.erl index 84ff809912..aa6cf4da0a 100644 --- a/lib/asn1/src/asn1rtt_per.erl +++ b/lib/asn1/src/asn1rtt_per.erl @@ -963,7 +963,10 @@ encode_relative_oid(Val) when is_list(Val) -> %% complete(L) -> - asn1rt_nif:encode_per_complete(L). + case asn1rt_nif:encode_per_complete(L) of + <<>> -> <<0>>; + Bin -> Bin + end. octets_to_complete(Len,Val) when Len < 256 -> [20,Len,Val]; 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>>. diff --git a/lib/asn1/test/asn1_SUITE_data/PartialDecSeq.asn1config b/lib/asn1/test/asn1_SUITE_data/PartialDecSeq.asn1config index d388f6cd02..0d91e0c3b3 100644 --- a/lib/asn1/test/asn1_SUITE_data/PartialDecSeq.asn1config +++ b/lib/asn1/test/asn1_SUITE_data/PartialDecSeq.asn1config @@ -4,14 +4,6 @@ {selected_decode_F3,['F',fb,b,[1]]}, {selected_decode_F4,['F',fb,d,da,[1],b,a]}, {selected_decode_E1,['E',d,dc,dcc,dcca]}]}}. -%% partial_incomplete_decode tuplen inneh�ller tv� element. Den -%% f�rsta �r bara en nyckel den andra �r en tupel med modulnamnet i -%% en tupel {module,Name} och det andra elementet �r en lista av tupler: -%% D�r varje tupel beskriver en partiell ofullst�ndig dekod. F�rsta -%% elementet i den tupeln �r namnet p� funktionen som ska g�ra den -%% partiella dekodningen. Det andra elementet �r en lista av typnamn/ -%% komponentnamn som �r en sekvens (path) till de element som ej skall -%% avkodas. {exclusive_decode,{'PartialDecSeq', [{decode_F_fb_incomplete,['F',[{fb,[{b,parts},{d,undecoded}]}]]}, {decode_D_incomplete,['D',[{a,undecoded}]]}, diff --git a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 index 17a5d3490a..c3d54dbbb3 100644 --- a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 @@ -22,6 +22,8 @@ BEGIN Enum ::= ENUMERATED {monday(1),tuesday(2),wednesday(3),thursday(4), friday(5),saturday(6),sunday(7)} + SingleEnumVal ::= ENUMERATED {true} + SingleEnumValExt ::= ENUMERATED {true, ...} ObjId ::= OBJECT IDENTIFIER @@ -35,4 +37,15 @@ BEGIN base (2), exponent (-125..128) } ) + Seq ::= SEQUENCE { + n Null, + i1 INTEGER (0..63), + e1 SingleEnumVal, + i2 INTEGER (0..63), + e2 SingleEnumVal, + i3 INTEGER (0..63), + b Bool, + i4 INTEGER (0..63) + } + END diff --git a/lib/asn1/test/asn1_SUITE_data/testobj.erl b/lib/asn1/test/asn1_SUITE_data/testobj.erl index 8d34a473ae..2cc909c35e 100644 --- a/lib/asn1/test/asn1_SUITE_data/testobj.erl +++ b/lib/asn1/test/asn1_SUITE_data/testobj.erl @@ -639,7 +639,7 @@ run_reset_res() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% Kod f�r att s�tta ihop RANAP-meddelanden +%% Code for constructing RANAP messages %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index 0d4427ba69..91fb9fffca 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.erl @@ -513,6 +513,14 @@ enum(Rules) -> case catch asn1_wrapper:encode('Prim','Enum',4) of Enum -> Enum end, ok end, + + case Rules of + Per when Per =:= per; Per =:= uper -> + {ok,<<0>>} = 'Prim':encode('SingleEnumVal', true), + {ok,<<0>>} = 'Prim':encode('SingleEnumValExt', true); + ber -> + ok + end, ok. diff --git a/lib/asn1/vsn.mk b/lib/asn1/vsn.mk index aaa060c806..3c4f3ff122 100644 --- a/lib/asn1/vsn.mk +++ b/lib/asn1/vsn.mk @@ -1,2 +1,2 @@ #next version number to use is 2.0 -ASN1_VSN = 2.0.1 +ASN1_VSN = 2.0.1.1 |