aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_check.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-09-25 12:53:56 +0200
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:24 +0100
commit081b4f03af69f67abf97f268d5d097918a6f3d6d (patch)
tree645a18437bd95c48db6a527a3be9a21a71ea2854 /lib/asn1/src/asn1ct_check.erl
parent3ab3b07afd07bb2fc59037e4b65f08c9038bf078 (diff)
downloadotp-081b4f03af69f67abf97f268d5d097918a6f3d6d.tar.gz
otp-081b4f03af69f67abf97f268d5d097918a6f3d6d.tar.bz2
otp-081b4f03af69f67abf97f268d5d097918a6f3d6d.zip
Correct recursion in OCTET STRING value definitions
Diffstat (limited to 'lib/asn1/src/asn1ct_check.erl')
-rw-r--r--lib/asn1/src/asn1ct_check.erl25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 30ec0c2aac..cc03cd68fe 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -2308,8 +2308,8 @@ normalize_value(S0, Type, {'DEFAULT',Value}, NameList) ->
normalize_integer(S0, Value, CType);
{'BIT STRING',CType,_} ->
normalize_bitstring(S,Value,CType);
- {'OCTET STRING',CType,_} ->
- normalize_octetstring(S0, Value, CType);
+ {'OCTET STRING',_,_} ->
+ normalize_octetstring(S0, Value);
{'NULL',_CType,_} ->
%%normalize_null(Value);
'NULL';
@@ -2451,17 +2451,26 @@ hex_to_int(D) when $A =< D, D =< $F -> D - ($A - 10).
%% {bstring,String} each element in String corresponds to one bit in an octet
%% {hstring,String} each element in String corresponds to one byte in an octet
%% #'Externalvaluereference'
-normalize_octetstring(S,Value,CType) ->
+normalize_octetstring(S, Value) ->
case Value of
{bstring,String} ->
bstring_to_binary(String);
{hstring,String} ->
hstring_to_binary(String);
- Rec when is_record(Rec,'Externalvaluereference') ->
- get_normalized_value(S,Value,CType,
- fun normalize_octetstring/3,[]);
- {Name,String} when is_atom(Name) ->
- normalize_octetstring(S,String,CType);
+ #'Externalvaluereference'{} ->
+ case get_referenced_value(S, Value) of
+ String when is_binary(String) ->
+ String;
+ Other ->
+ normalize_octetstring(S, Other)
+ end;
+ {'ValueFromObject',{object,Obj},FieldNames} ->
+ case extract_field(S, Obj, FieldNames) of
+ #valuedef{value=Val} when is_binary(Val) ->
+ Val;
+ _ ->
+ asn1_error(S, illegal_octet_string_value)
+ end;
_ ->
asn1_error(S, illegal_octet_string_value)
end.