aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-04-02 13:39:50 +0200
committerBjörn Gustavsson <[email protected]>2013-04-03 16:38:31 +0200
commitf7c7510b55efe6a1ab1133f47ec4c3b0371784e8 (patch)
tree76c89f1eeb6044f6b9c949f8295f5a6170c7e779 /lib/asn1
parent45e356fb7b5d381a6e3c9ec83bf20fe9cefe8e4b (diff)
downloadotp-f7c7510b55efe6a1ab1133f47ec4c3b0371784e8.tar.gz
otp-f7c7510b55efe6a1ab1133f47ec4c3b0371784e8.tar.bz2
otp-f7c7510b55efe6a1ab1133f47ec4c3b0371784e8.zip
Prevent loss of objects after the extension marker
In an object set with a single root object, objects after the extension marker would be lost.
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/src/asn1ct_check.erl4
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Param2.asn112
-rw-r--r--lib/asn1/test/testParameterizedInfObj.erl5
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 2b48c62ac9..99b09c4e90 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -1025,8 +1025,8 @@ prepare_objset({{'SingleValue',Set},Ext}) ->
%% {set,lists:append([Set,Ext]),true};
prepare_objset({Set,Ext}) when is_list(Set) ->
{set,merge_sets(Set,Ext),true};
-prepare_objset({ObjDef={object,definedsyntax,_ObjFields},_Ext}) ->
- {set,[ObjDef],true};
+prepare_objset({{object,definedsyntax,_ObjFields}=Set,Ext}) ->
+ {set,merge_sets(Set, Ext),true};
prepare_objset(ObjDef={object,definedsyntax,_ObjFields}) ->
{set,[ObjDef],false};
prepare_objset({ObjDef=#type{},Ext}) when is_list(Ext) ->
diff --git a/lib/asn1/test/asn1_SUITE_data/Param2.asn1 b/lib/asn1/test/asn1_SUITE_data/Param2.asn1
index 4393f875b6..09ccb367d8 100644
--- a/lib/asn1/test/asn1_SUITE_data/Param2.asn1
+++ b/lib/asn1/test/asn1_SUITE_data/Param2.asn1
@@ -33,4 +33,16 @@ BEGIN
--Delete-end
}
+ SingleRoot ::= SEQUENCE {
+ protocolIEs ProtocolIE-Container { { SingleRootIEs } },
+ ...
+ }
+
+ -- The extension was lost when there was a single root item.
+ SingleRootIEs S1AP-PROTOCOL-IES ::= {
+ { ID 1 TYPE OCTET STRING },
+ ...,
+ { ID 2 TYPE INTEGER }
+ }
+
END
diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl
index 2c3bb0d119..940b96a339 100644
--- a/lib/asn1/test/testParameterizedInfObj.erl
+++ b/lib/asn1/test/testParameterizedInfObj.erl
@@ -141,6 +141,11 @@ param2(Config, Erule) ->
asn1_wrapper:decode('Param2', 'HandoverRequired', Enc),
true = is_binary(Open100),
true = is_binary(Open101),
+
+ %% Test single root.
+ roundtrip2('SingleRoot',
+ {'SingleRoot',[{'ProtocolIE-Field',1,"ABC"},
+ {'ProtocolIE-Field',2,9999}]}),
ok.