diff options
author | Björn Gustavsson <[email protected]> | 2017-08-10 14:52:31 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2017-08-16 16:28:57 +0200 |
commit | 5d33ec9021ff4fa8e3ffac01bdd0228871636edd (patch) | |
tree | 5364028375eee410b120d75a3c4c6d36abfd1a31 /lib/asn1/src/asn1ct_constructed_per.erl | |
parent | 6ede2da826335960037299d9f3b0e66d072ea5a0 (diff) | |
download | otp-5d33ec9021ff4fa8e3ffac01bdd0228871636edd.tar.gz otp-5d33ec9021ff4fa8e3ffac01bdd0228871636edd.tar.bz2 otp-5d33ec9021ff4fa8e3ffac01bdd0228871636edd.zip |
Fix broken handling of default values in extensions for PER
Default values have never worked in extension for PER.
Note that for default values in the root part of SEQUENCE,
giving a value equal to the DEFAULT value, will result in
the same encoding as if asn1_DEFAULT was given. However,
that behavior is not promised by the documentation. The
documentation says that asn1_DEFAULT should be used for
default values. For DEFAULT in extensions, only implement
what the documentation promises and nothing more.
ERIERL-60
Diffstat (limited to 'lib/asn1/src/asn1ct_constructed_per.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_constructed_per.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl index 3f1be4febb..aff383479b 100644 --- a/lib/asn1/src/asn1ct_constructed_per.erl +++ b/lib/asn1/src/asn1ct_constructed_per.erl @@ -985,9 +985,11 @@ gen_enc_components_call1(Gen, TopType, [C|Rest], DynamicEnc, Ext) -> Imm1; 'OPTIONAL' -> enc_absent(Gen, Element, [asn1_NOVALUE], Imm1); - {'DEFAULT',Def} -> + {'DEFAULT',Def} when Ext =:= noext -> DefValues = def_values(Type, Def), - enc_absent(Gen, Element, DefValues, Imm1) + enc_absent(Gen, Element, DefValues, Imm1); + {'DEFAULT',_} -> + enc_absent(Gen, Element, [asn1_DEFAULT], Imm1) end, Imm = case Imm2 of [] -> []; |