Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000847Taste[All Projects] ASN.1 Compiler v4public2019-03-25 18:122019-09-26 14:05
Reportergmamais 
Assigned Togmamais 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Summary0000847:

WITH COMPONENTS constraints are not properly handled

Description

The following grammar crashes the ASN.1 compiler.

MySeq ::= SEQUENCE {
    field1 INTEGER (1..10),
    field2 INTEGER (1..100) ,
    point SEQUENCE {
       x INTEGER (1..1280),
       y INTEGER  (1..1024)
    }
} (WITH COMPONENTS { field1 (3..10), field2 (30..50), point (WITH COMPONENTS {x (1..200), y(1..400) } ) } | 
WITH COMPONENTS { field1 (20 .. 70), field2 (80 .. 90) } |
WITH COMPONENTS { field2 (100) }   )
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0003611)
gmamais (developer)
2019-04-07 18:06

fixed in latest commit

(0003612)
maxime (administrator)
2019-04-08 06:52

I tried this grammar

1   │ TY DEFINITIONS ::=
2   │ BEGIN
3   │  Toto ::= SEQUENCE {
4   │    a INTEGER (0..255),
5   │    b BOOLEAN OPTIONAL
6   │  }
7   │ 
8   │  Titi ::= Toto (WITH COMPONENTS { a (3), b ABSENT } | WITH COMPONENTS  {a (ALL EXCEPT 3), b PRESENT })
9   │ END

Compilation fails with -atc

test.c:76:2: error: implicit declaration of function 'Titi_a_Initialize'; did you mean 'Titi_Initialize'? [-Werror=implicit-function-declaration]
  Titi_a_Initialize((&(pVal->a)));
  ^~~~~~~~~~~~~~~~~
 Titi_Initialize
(0003613)
maxime (administrator)
2019-04-08 06:57

There also seems to be a syntax error in test case 005.asn in the test suite:

16   │ MySeqOf ::= SEQUENCE ((SIZE(1..20)) ^
17   │                     (WITH COMPONENT (
18   │                             WITH COMPONENTS { field1 (3..10) PRESENT, field2 (30..50), point (WITH COMPONENTS {x (1..200), y(1..400), z ABSENT } ) } | 
19   │                             WITH COMPONENTS { ..., field1 (20 .. 70), field2 (80 .. 90) } |
20   │                             WITH COMPONENTS { ..., field1 ABSENT, field2 (100) }
21   │                        ))) 
22   │         OF  MySeq

According to OSS'playground, this is incorrect. The error is:

line 16 (TEST-CASE): C0329E: The WITH COMPONENT constraint cannot be used between the SEQUENCE and OF.  Please place the constraint on the component of the SEQUENCE OF type.
                (WITH COMPONENT (
(0003614)
maxime (administrator)
2019-04-08 10:01

Another issue : something is messed up in the Generic backends:

The Min/Max values for fields have some text such as:

"Min": "CommonTypes+SIZE", "Max": "CommonTypes+SIZE"
(0003615)
gmamais (developer)
2019-04-08 12:06

initialization and Min/Max issues were fixed.
Regarding the syntax error.
I think that the syntax is OK.
If you look at page 232, paragraph 12.4.2 of Mr Olivier Dubuisson, you will see that this allowed.

TypeWithConstraint --> SEQUENCE Constraint OF Type

Constraint should be a subtype constraint (or a combination of constraints)
by a single value (of the form \SEQUENCE (v) OF T", see rule h2i
on page 261), by type inclusion (of the form \SEQUENCE (INCLUDES T1)
OF T", see rule h4i on page 263), by size (of the form \SEQUENCE SIZE (n)
OF T", see below) or a constraint on the elements (of the form \SEQUENCE
(WITH COMPONENT (Constraint )) OF T", see rule h1i on page 277).

(0003616)
maxime (administrator)
2019-04-08 14:47

Thanks for the fixes and the details about the syntax.

If you take my grammar above it now indeed passes compilation, however -atc -c -uPER results in errors:

./mainprogram 
Test case test_case_UPER_000006 failed in encoding.
========================================
Test case test_case_UPER_000008 failed in encoding.
========================================
2 out of 8 failed.
(0003653)
maxime (administrator)
2019-09-26 14:05

Closing, it is acknowledged that some complex subtypes lead to the impossibility to generate proper, complete test scripts with -atc


- Issue History
Date Modified Username Field Change
2019-03-25 18:12 gmamais New Issue
2019-03-25 18:13 gmamais Assigned To

=> gmamais

2019-03-25 18:13 gmamais Status

new => assigned

2019-03-25 18:14 maxime Description Updated View Revisions
2019-03-25 18:15 maxime Description Updated View Revisions
2019-03-25 18:19 maxime Description Updated View Revisions
2019-03-25 18:20 maxime Description Updated View Revisions
2019-04-07 18:06 gmamais Note Added: 0003611
2019-04-07 18:06 gmamais Status

assigned => resolved

2019-04-07 18:06 gmamais Resolution

open => fixed

2019-04-08 06:52 maxime Note Added: 0003612
2019-04-08 06:52 maxime Status

resolved => feedback

2019-04-08 06:52 maxime Resolution

fixed => reopened

2019-04-08 06:57 maxime Note Added: 0003613
2019-04-08 10:01 maxime Note Added: 0003614
2019-04-08 12:06 gmamais Note Added: 0003615
2019-04-08 12:06 gmamais Status

feedback => assigned

2019-04-08 12:06 gmamais Status

assigned => resolved

2019-04-08 12:06 gmamais Resolution

reopened => fixed

2019-04-08 14:47 maxime Note Added: 0003616
2019-04-08 14:48 maxime Status

resolved => feedback

2019-04-08 14:48 maxime Resolution

fixed => reopened

2019-09-26 14:05 maxime Note Added: 0003653
2019-09-26 14:05 maxime Status

feedback => closed

2019-09-26 14:05 maxime Resolution

reopened => fixed



Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker