aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-10-15 12:10:00 +0200
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:25 +0100
commit55f6965558bed5bfbcf178d0203b7311b447b81a (patch)
tree69232bf01afe38806fd762da684d19fd32a1632e
parente43a382e7207a3c01baba2ef202b49766b60fdae (diff)
downloadotp-55f6965558bed5bfbcf178d0203b7311b447b81a.tar.gz
otp-55f6965558bed5bfbcf178d0203b7311b447b81a.tar.bz2
otp-55f6965558bed5bfbcf178d0203b7311b447b81a.zip
Handle CLASS.&field when checking values
-rw-r--r--lib/asn1/src/asn1ct_check.erl8
-rw-r--r--lib/asn1/test/asn1_SUITE_data/InfObj.asn24
-rw-r--r--lib/asn1/test/testInfObj.erl2
3 files changed, 33 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 996c040373..9af88166e8 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -2079,7 +2079,13 @@ check_valuedef(#state{recordtopname=TopName}=S0, V0) ->
case Type of
#classdef{} ->
throw({objectdef});
- #typedef{typespec=TypeSpec} ->
+ #typedef{typespec=TypeSpec0}=TypeDef ->
+ TypeSpec = try check_type(S2, TypeDef, TypeSpec0) of
+ TypeSpec1 -> TypeSpec1
+ catch
+ throw:{asn1_class,_} ->
+ throw({objectdef})
+ end,
S3 = case is_contextswitchtype(Type) of
true ->
S2;
diff --git a/lib/asn1/test/asn1_SUITE_data/InfObj.asn b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
index b24d747f0e..9dbee3f516 100644
--- a/lib/asn1/test/asn1_SUITE_data/InfObj.asn
+++ b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
@@ -380,6 +380,30 @@ value-1 OBJECT IDENTIFIER ::= obj1.&id
value-3 RELATIVE-OID ::= obj1.&rid
value-4 OBJECT IDENTIFIER ::= { 1 2 value-3 }
+
+-- Test an obscure issue when ATTRIBUTE.&id was not
+-- properly evaluated.
+
+Rdn ::= SingleAttribute { {SupportedAttributes} }
+
+ATTRIBUTE ::= CLASS {
+ &id OBJECT IDENTIFIER UNIQUE,
+ &Type OPTIONAL
+}
+
+SingleAttribute{ATTRIBUTE:AttrSet} ::= SEQUENCE {
+ type ATTRIBUTE.&id({AttrSet}),
+ value ATTRIBUTE.&Type({AttrSet}{@type})
+}
+
+AttributeType ::= ATTRIBUTE.&id
+
+SupportedAttributes ATTRIBUTE ::= { at-name }
+
+id-at OBJECT IDENTIFIER ::= { 2 5 4 41 }
+id-at-name AttributeType ::= id-at
+at-name ATTRIBUTE ::= { &Type PrintableString, &id id-at-name }
+
END
diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl
index aa617b632f..09fe549f0d 100644
--- a/lib/asn1/test/testInfObj.erl
+++ b/lib/asn1/test/testInfObj.erl
@@ -151,6 +151,8 @@ main(_Erule) ->
{100,101} = 'InfObj':'value-3'(),
{1,2,100,101} = 'InfObj':'value-4'(),
+ roundtrip('InfObj', 'Rdn', {'Rdn',{2,5,4,41},"abc"}),
+
ok.
test_objset(Type, Keys) ->