aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/src/asn1rtt_per.erl2
-rw-r--r--lib/asn1/src/asn1rtt_uper.erl2
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Constraints.py2
-rw-r--r--lib/asn1/test/testConstraints.erl10
4 files changed, 14 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1rtt_per.erl b/lib/asn1/src/asn1rtt_per.erl
index 21acb4e1ec..9f4b7500d8 100644
--- a/lib/asn1/src/asn1rtt_per.erl
+++ b/lib/asn1/src/asn1rtt_per.erl
@@ -173,7 +173,7 @@ encode_integer([{'ValueRange',{Lb,Ub}=VR,Range,PreEnc}],Val)
when Val >= Lb, Ub >= Val ->
%% this case when NamedNumberList
encode_constrained_number(VR, Range, PreEnc, Val);
-encode_integer([{'ValueRange',{Lb,'MAX'}}], Val) ->
+encode_integer([{'ValueRange',{Lb,'MAX'}}], Val) when Lb =< Val ->
encode_semi_constrained_number(Lb, Val);
encode_integer([{'ValueRange',{'MIN',_}}], Val) ->
encode_unconstrained_number(Val);
diff --git a/lib/asn1/src/asn1rtt_uper.erl b/lib/asn1/src/asn1rtt_uper.erl
index 320038caa2..a5035c6660 100644
--- a/lib/asn1/src/asn1rtt_uper.erl
+++ b/lib/asn1/src/asn1rtt_uper.erl
@@ -223,7 +223,7 @@ encode_integer1(C, Val) ->
case VR = get_constraint(C, 'ValueRange') of
no ->
encode_unconstrained_number(Val);
- {Lb,'MAX'} ->
+ {Lb,'MAX'} when Lb =< Val ->
encode_semi_constrained_number(Lb, Val);
%% positive with range
{Lb,Ub} when Val >= Lb, Ub >= Val ->
diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py
index 1d2f4bc44c..e4bc987e4c 100644
--- a/lib/asn1/test/asn1_SUITE_data/Constraints.py
+++ b/lib/asn1/test/asn1_SUITE_data/Constraints.py
@@ -14,6 +14,8 @@ LongLong ::= INTEGER (0..18446744073709551615)
Range256to65536 ::= INTEGER (256..65536)
SemiConstrained ::= INTEGER (100..MAX)
NegSemiConstrained ::= INTEGER (-128..MAX)
+SemiConstrainedExt ::= INTEGER (42..MAX, ...)
+NegSemiConstrainedExt ::= INTEGER (-128..MAX, ...)
-- Other constraints
FixedSize ::= OCTET STRING (SIZE(10))
diff --git a/lib/asn1/test/testConstraints.erl b/lib/asn1/test/testConstraints.erl
index b90ae8cab2..e825302629 100644
--- a/lib/asn1/test/testConstraints.erl
+++ b/lib/asn1/test/testConstraints.erl
@@ -131,6 +131,16 @@ int_constraints(Rules) ->
roundtrip('NegSemiConstrained', -1),
roundtrip('NegSemiConstrained', 500),
+ roundtrip('SemiConstrainedExt', -65536),
+ roundtrip('SemiConstrainedExt', 0),
+ roundtrip('SemiConstrainedExt', 42),
+ roundtrip('SemiConstrainedExt', 100),
+ roundtrip('SemiConstrainedExt', 47777789),
+ roundtrip('NegSemiConstrainedExt', -1023),
+ roundtrip('NegSemiConstrainedExt', -128),
+ roundtrip('NegSemiConstrainedExt', -1),
+ roundtrip('NegSemiConstrainedExt', 500),
+
%%==========================================================
%% SIZE Constraint (Duboisson p. 268)
%% T ::= IA5String (SIZE (1|2, ..., SIZE (1|2|3)))