aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-04-23 10:39:50 +0200
committerBjörn Gustavsson <[email protected]>2013-05-31 14:52:24 +0200
commit4709d67f92bf89c264e38fbf94e3324edd922ac8 (patch)
tree87778bf38d0a7ff33aabbec5023690bf21c0ba1f /lib/asn1/src
parenta1495bd1e09dbefa8595e9388140140c143088f2 (diff)
downloadotp-4709d67f92bf89c264e38fbf94e3324edd922ac8.tar.gz
otp-4709d67f92bf89c264e38fbf94e3324edd922ac8.tar.bz2
otp-4709d67f92bf89c264e38fbf94e3324edd922ac8.zip
Fix encoding of semi-constrained, extensible INTEGERs
Given: Semi ::= INTEGER (Lb..MAX, ...) where Lb is an arbitrary integer, attempting to encode an integer less than Lb would cause the encoder to enter an infinite loop.
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1rtt_per.erl2
-rw-r--r--lib/asn1/src/asn1rtt_uper.erl2
2 files changed, 2 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 ->