diff options
author | Björn Gustavsson <[email protected]> | 2014-09-25 12:53:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-12 11:40:24 +0100 |
commit | 081b4f03af69f67abf97f268d5d097918a6f3d6d (patch) | |
tree | 645a18437bd95c48db6a527a3be9a21a71ea2854 /lib/asn1/src | |
parent | 3ab3b07afd07bb2fc59037e4b65f08c9038bf078 (diff) | |
download | otp-081b4f03af69f67abf97f268d5d097918a6f3d6d.tar.gz otp-081b4f03af69f67abf97f268d5d097918a6f3d6d.tar.bz2 otp-081b4f03af69f67abf97f268d5d097918a6f3d6d.zip |
Correct recursion in OCTET STRING value definitions
Diffstat (limited to 'lib/asn1/src')
-rw-r--r-- | lib/asn1/src/asn1ct_check.erl | 25 |
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. |