Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0827-asn1-Fix-handling-of-SIZE-constraints.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0827-asn1-Fix-handling-of-SIZE-constraints.patch of Package erlang
From 6b098b7a37343e3f477e6778e7ccf649ad5f3c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Fri, 18 Aug 2023 09:43:24 +0200 Subject: [PATCH] asn1: Fix handling of SIZE constraints A constraint such as: (SIZE (1..4), ...) is supposed to be equivalent to: (SIZE (1..4, ...)) but the former variant was ignored by the ASN.1 compiler, causing the size to be incorrectly encoded and decoded by PER backends. --- lib/asn1/src/asn1ct_check.erl | 14 ++++++++++++++ .../asn1_SUITE_data/ConstraintEquivalence.asn1 | 2 ++ 2 files changed, 16 insertions(+) diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 8b7144b5f9..f1e8a19128 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -3559,6 +3559,20 @@ range_union_1([]) -> finish_constraints(Cs) -> finish_constraints_1(Cs, fun smart_collapse/1). +finish_constraints_1([{element_set,{'SizeConstraint', + {element_set,Root,none}}, + {set,[]}=Set}|T], + Collapse) -> + %% Rewrite: + %% + %% (SIZE (Lower..Upper), ...) + %% + %% to: + %% + %% (SIZE (Lower..Upper, ...)) + + C = {element_set,{'SizeConstraint',{element_set,Root,Set}},none}, + finish_constraints_1([C|T], Collapse); finish_constraints_1([{element_set,{Tag,{element_set,_,_}=Set0},none}|T], Collapse0) -> Collapse = collapse_fun(Tag), diff --git a/lib/asn1/test/asn1_SUITE_data/ConstraintEquivalence.asn1 b/lib/asn1/test/asn1_SUITE_data/ConstraintEquivalence.asn1 index 648275dd66..291734e231 100644 --- a/lib/asn1/test/asn1_SUITE_data/ConstraintEquivalence.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/ConstraintEquivalence.asn1 @@ -106,6 +106,8 @@ BEGIN ExtConstrainedStringX04 ::= IA5String (SIZE (1|2), ..., SIZE (1|2|3|4|5)) ExtConstrainedStringX05 ::= IA5String (SIZE (1|2, ...), ..., SIZE (1|2|3|4|5, ...)) + -- The following syntax is not recommended, but should work. + ExtConstrainedStringX06 ::= IA5String (SIZE (1..2), ...) integer4 INTEGER ::= 4 integer11 INTEGER ::= 11 -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor