diff options
author | Ingela Andin <ingela@erlang.org> | 2020-03-18 08:08:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 08:08:10 +0100 |
commit | 206985e1bb7eaf6ad60e16d551b96734e2e0efb8 (patch) | |
tree | acaeddb4ebfa4cbb31442e47882ae22458c95a5d /lib/asn1 | |
parent | 85432343f1ab9159e68f7ce5ebad6d3c1d44952a (diff) | |
parent | c86aab85f164131abf48abf3fc473f3f718d1e67 (diff) | |
download | erlang-206985e1bb7eaf6ad60e16d551b96734e2e0efb8.tar.gz |
Merge pull request #2561 from montag451/master
Fix ERL-1189
OTP-16554
Diffstat (limited to 'lib/asn1')
-rw-r--r-- | lib/asn1/src/asn1ct.erl | 3 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE.erl | 3 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn | 12 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn1config | 2 | ||||
-rw-r--r-- | lib/asn1/test/test_selective_decode.erl | 8 |
5 files changed, 26 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct.erl b/lib/asn1/src/asn1ct.erl index 5708d5cb7e..2fd98ab51f 100644 --- a/lib/asn1/src/asn1ct.erl +++ b/lib/asn1/src/asn1ct.erl @@ -1693,6 +1693,9 @@ create_pdec_command(ModName,{'CHOICE',[Comp=#'ComponentType'{name=C1}|_]},TNL=[C create_pdec_command(ModName,[Comp],TNL,Acc); create_pdec_command(ModName,{'CHOICE',[#'ComponentType'{}|Comps]},TNL,Acc) -> create_pdec_command(ModName,{'CHOICE',Comps},TNL,Acc); +create_pdec_command(ModName,{'CHOICE',{Cs1,Cs2}},TNL,Acc) + when is_list(Cs1),is_list(Cs2) -> + create_pdec_command(ModName,{'CHOICE',Cs1 ++ Cs2},TNL,Acc); create_pdec_command(ModName,#'Externaltypereference'{module=M,type=C1}, TypeNameList,Acc) -> #type{def=Def} = get_referenced_type(M,C1), diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 70c70208e4..68e892e576 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -979,7 +979,8 @@ specialized_decodes(Config, Rule, Opts) -> "PartialDecSeq3.asn", "PartialDecMyHTTP.asn", "MEDIA-GATEWAY-CONTROL.asn", - "P-Record"], + "P-Record", + "PartialDecChoExtension.asn"], Config, [Rule,legacy_erlang_types,asn1config|Opts]), test_partial_incomplete_decode:test(Config), diff --git a/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn b/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn new file mode 100644 index 0000000000..128e5966d8 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn @@ -0,0 +1,12 @@ +PartialDecChoExtension DEFINITIONS IMPLICIT TAGS ::= + +BEGIN + +ChoExt ::= CHOICE +{ + i BOOLEAN, + ..., + j INTEGER +} + +END diff --git a/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn1config b/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn1config new file mode 100644 index 0000000000..32265b03e4 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/PartialDecChoExtension.asn1config @@ -0,0 +1,2 @@ +{selective_decode, {'PartialDecChoExtension', + [{selected_decode_ChoExt, ['ChoExt', j]}]}}. diff --git a/lib/asn1/test/test_selective_decode.erl b/lib/asn1/test/test_selective_decode.erl index c264e919a6..df48b5e65c 100644 --- a/lib/asn1/test/test_selective_decode.erl +++ b/lib/asn1/test/test_selective_decode.erl @@ -51,6 +51,10 @@ test() -> Bytes4 = roundtrip('P-Record', 'PersonnelRecord', PRecMsg, PRecMsgDec), {ok,_} = 'P-Record':sel_dec(Bytes4), + ChoExtMsg = msg('ChoExt'), + Bytes5 = roundtrip('PartialDecChoExtension', 'ChoExt', ChoExtMsg), + {ok, 42} = 'PartialDecChoExtension':selected_decode_ChoExt(Bytes5), + ok. msg('F') -> @@ -60,8 +64,10 @@ msg('E') -> {'E',10,[{'D',11,true},{'D',12,false}],false,{dc,{'E_d_dc',13,true,{'E_d_dc_dcc',14,15}}}}; msg('M-G-C') -> - {'MegacoMessage',asn1_NOVALUE,{'Message',1,{ip4Address,{'IP4Address',[125,125,125,111],55555}},{transactions,[{transactionReply,{'TransactionReply',50007,asn1_NOVALUE,{actionReplies,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE,[{auditValueReply,{auditResult,{'AuditResult',{'TerminationID',[],[255,255,255]},[{mediaDescriptor,{'MediaDescriptor',asn1_NOVALUE,{multiStream,[{'StreamDescriptor',1,{'StreamParms',{'LocalControlDescriptor',sendRecv,asn1_NOVALUE,asn1_NOVALUE,[{'PropertyParm',[0,11,0,7],[[52,48]],asn1_NOVALUE}]},{'LocalRemoteDescriptor',[[{'PropertyParm',[0,0,176,1],[[48]],asn1_NOVALUE},{'PropertyParm',[0,0,176,8],[[73,78,32,73,80,52,32,49,50,53,46,49,50,53,46,49,50,53,46,49,49,49]],asn1_NOVALUE},{'PropertyParm',[0,0,176,15],[[97,117,100,105,111,32,49,49,49,49,32,82,84,80,47,65,86,80,32,32,52]],asn1_NOVALUE},{'PropertyParm',[0,0,176,12],[[112,116,105,109,101,58,51,48]],asn1_NOVALUE}]]},{'LocalRemoteDescriptor',[[{'PropertyParm',[0,0,176,1],[[48]],asn1_NOVALUE},{'PropertyParm',[0,0,176,8],[[73,78,32,73,80,52,32,49,50,52,46,49,50,52,46,49,50,52,46,50,50,50]],asn1_NOVALUE},{'PropertyParm',[0,0,176,15],[[97,117,100,105,111,32,50,50,50,50,32,82,84,80,47,65,86,80,32,32,52]],asn1_NOVALUE},{'PropertyParm',[0,0,176,12],[[112,116,105,109,101,58,51,48]],asn1_NOVALUE}]]}}}]}}},{packagesDescriptor,[{'PackagesItem',[0,11],1},{'PackagesItem',[0,11],1}]},{statisticsDescriptor,[{'StatisticsParameter',[0,12,0,4],[[49,50,48,48]]},{'StatisticsParameter',[0,11,0,2],[[54,50,51,48,48]]},{'StatisticsParameter',[0,12,0,5],[[55,48,48]]},{'StatisticsParameter',[0,11,0,3],[[52,53,49,48,48]]},{'StatisticsParameter',[0,12,0,6],[[48,46,50]]},{'StatisticsParameter',[0,12,0,7],[[50,48]]},{'StatisticsParameter',[0,12,0,8],[[52,48]]}]}]}}}]}]}}}]}}}. + {'MegacoMessage',asn1_NOVALUE,{'Message',1,{ip4Address,{'IP4Address',[125,125,125,111],55555}},{transactions,[{transactionReply,{'TransactionReply',50007,asn1_NOVALUE,{actionReplies,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE,[{auditValueReply,{auditResult,{'AuditResult',{'TerminationID',[],[255,255,255]},[{mediaDescriptor,{'MediaDescriptor',asn1_NOVALUE,{multiStream,[{'StreamDescriptor',1,{'StreamParms',{'LocalControlDescriptor',sendRecv,asn1_NOVALUE,asn1_NOVALUE,[{'PropertyParm',[0,11,0,7],[[52,48]],asn1_NOVALUE}]},{'LocalRemoteDescriptor',[[{'PropertyParm',[0,0,176,1],[[48]],asn1_NOVALUE},{'PropertyParm',[0,0,176,8],[[73,78,32,73,80,52,32,49,50,53,46,49,50,53,46,49,50,53,46,49,49,49]],asn1_NOVALUE},{'PropertyParm',[0,0,176,15],[[97,117,100,105,111,32,49,49,49,49,32,82,84,80,47,65,86,80,32,32,52]],asn1_NOVALUE},{'PropertyParm',[0,0,176,12],[[112,116,105,109,101,58,51,48]],asn1_NOVALUE}]]},{'LocalRemoteDescriptor',[[{'PropertyParm',[0,0,176,1],[[48]],asn1_NOVALUE},{'PropertyParm',[0,0,176,8],[[73,78,32,73,80,52,32,49,50,52,46,49,50,52,46,49,50,52,46,50,50,50]],asn1_NOVALUE},{'PropertyParm',[0,0,176,15],[[97,117,100,105,111,32,50,50,50,50,32,82,84,80,47,65,86,80,32,32,52]],asn1_NOVALUE},{'PropertyParm',[0,0,176,12],[[112,116,105,109,101,58,51,48]],asn1_NOVALUE}]]}}}]}}},{packagesDescriptor,[{'PackagesItem',[0,11],1},{'PackagesItem',[0,11],1}]},{statisticsDescriptor,[{'StatisticsParameter',[0,12,0,4],[[49,50,48,48]]},{'StatisticsParameter',[0,11,0,2],[[54,50,51,48,48]]},{'StatisticsParameter',[0,12,0,5],[[55,48,48]]},{'StatisticsParameter',[0,11,0,3],[[52,53,49,48,48]]},{'StatisticsParameter',[0,12,0,6],[[48,46,50]]},{'StatisticsParameter',[0,12,0,7],[[50,48]]},{'StatisticsParameter',[0,12,0,8],[[52,48]]}]}]}}}]}]}}}]}}}; +msg('ChoExt') -> + {j, 42}. roundtrip(M, T, V) -> asn1_test_lib:roundtrip_enc(M, T, V). |