aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/src/asn1ct_imm.erl6
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Constraints.py3
-rw-r--r--lib/asn1/test/testConstraints.erl4
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl
index 892178f61b..7408255aea 100644
--- a/lib/asn1/src/asn1ct_imm.erl
+++ b/lib/asn1/src/asn1ct_imm.erl
@@ -2123,8 +2123,10 @@ fixup_put_bits(Other) -> per_fixup(Other).
%% returns a value range that has the lower bound set to the lowest value
%% of all single values and lower bound values in C and the upper bound to
%% the greatest value.
-effective_constraint(integer,[C={{_,_},_}|_Rest]) -> % extension
- [C];
+effective_constraint(integer, [{{_,_}=Root,_}|_Rest]) ->
+ %% Normalize extension. Note that any range given for the
+ %% extension should be ignored anyway.
+ [{Root,[]}];
effective_constraint(integer, C) ->
SVs = get_constraints(C, 'SingleValue'),
SV = effective_constr('SingleValue', SVs),
diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py
index e4bc987e4c..2afc9de779 100644
--- a/lib/asn1/test/asn1_SUITE_data/Constraints.py
+++ b/lib/asn1/test/asn1_SUITE_data/Constraints.py
@@ -16,6 +16,9 @@ SemiConstrained ::= INTEGER (100..MAX)
NegSemiConstrained ::= INTEGER (-128..MAX)
SemiConstrainedExt ::= INTEGER (42..MAX, ...)
NegSemiConstrainedExt ::= INTEGER (-128..MAX, ...)
+-- Extensions --
+LongLongExt ::= INTEGER (0..18446744073709551615, ..., -5000..-1)
+Range256to65536Ext ::= INTEGER (256..65536, ..., 1000000..9000000)
-- Other constraints
FixedSize ::= OCTET STRING (SIZE(10))
diff --git a/lib/asn1/test/testConstraints.erl b/lib/asn1/test/testConstraints.erl
index 03a09492af..3d04a1514b 100644
--- a/lib/asn1/test/testConstraints.erl
+++ b/lib/asn1/test/testConstraints.erl
@@ -70,6 +70,8 @@ int_constraints(Rules) ->
%%==========================================================
LastNumWithoutLengthEncoding = 65536,
roundtrip('Range256to65536', LastNumWithoutLengthEncoding),
+ roundtrip('Range256to65536Ext', LastNumWithoutLengthEncoding),
+ roundtrip('Range256to65536Ext', 42),
FirstNumWithLengthEncoding = 65537,
roundtrip('LargeConstraints', 'RangeMax', FirstNumWithLengthEncoding),
@@ -95,6 +97,8 @@ int_constraints(Rules) ->
%% Random number within longlong range
LongLong = 12672809400538808320,
roundtrip('LongLong', LongLong),
+ roundtrip('LongLongExt', LongLong),
+ roundtrip('LongLongExt', -10000),
%%==========================================================
%% Constraint Combinations (Duboisson p. 285)