Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix : OER constraint for asn1/its/Elevation.c + UPER contraints for ans1/its/DeltaReferencePositions & ans1/its/DeltaPositions #226

Closed
wants to merge 4 commits into from

Conversation

Rom-1T
Copy link

@Rom-1T Rom-1T commented May 22, 2024

Hello,

After this issue : #225. I've come accross to a bug, the Elevation.c in asn/its was causing a problem for the decoding of secured packet. I've just changed the OER constraint to limit potential repercussion outside of secured packet.

Also, I've discovered that when I receives IVIM packets with PolygonalLine/DeltaPositions_t I have problem decoding. It appears that the UPER constraint was wrong, I've only looked at DeltaPositions and DeltaReferencePositions.

@@ -15,7 +15,7 @@ static asn_oer_constraints_t asn_OER_type_DeltaPositions_constr_1 CC_NOTUSED = {
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
asn_per_constraints_t asn_PER_type_DeltaPositions_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED | APC_EXTENSIBLE, 7, 7, 1, 100 } /* (SIZE(1..100,...)) */,
{ APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 1, 32 } /* (SIZE(1..100,...)) */,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not patch the generated sources but update the used ISO 19321 ASN.1 file which includes the changed sequence constraints. At the moment, we fetch "ed-2" in fetch_iso_asn1_files.cmake, the changed constraints are included in "ed-3".

@@ -15,7 +15,7 @@ static asn_oer_constraints_t asn_OER_type_DeltaReferencePositions_constr_1 CC_NO
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
asn_per_constraints_t asn_PER_type_DeltaReferencePositions_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED | APC_EXTENSIBLE, 7, 7, 1, 100 } /* (SIZE(1..100,...)) */,
{ APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 1, 32 } /* (SIZE(1..32,...))*/,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, update ISO 19321 ASN.1 used for code generation instead.

@@ -38,7 +38,7 @@ Elevation_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
*/
#if !defined(ASN_DISABLE_OER_SUPPORT)
static asn_oer_constraints_t asn_OER_type_Elevation_constr_1 CC_NOTUSED = {
{ 4, 0 } /* (-4096..61439) */,
{ 2, 1 } /* (-4096..61439) */,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the number of values fits in an uint16_t. Does asn1c already shift the values as expected, i.e. a raw 0 is decoded as -4096 in Elevation_t?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Section 2.2 of https://www.oss.com/asn1/resources/books-whitepapers-pubs/Overview_of_OER.pdf summarizes the OER encoding rules for integer types. According to this summary, the Elevation type with a lower bound of -4096 and an upper bound of 61439 is encoded as a signed integer in four octets.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see also ITU-T X.696 (02/2021) 10.4 c)
Elevation with given bounds must be encoded using 4 octets as signed integer.

@Rom-1T Rom-1T closed this Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants