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

asn1 compilation with parameter and extension fails #4902

Closed
sebastiw opened this issue May 27, 2021 · 2 comments
Closed

asn1 compilation with parameter and extension fails #4902

sebastiw opened this issue May 27, 2021 · 2 comments
Assignees
Labels
bug Issue is reported as a bug in progress team:PO Assigned to OTP team PO

Comments

@sebastiw
Copy link
Contributor

Describe the bug
Compilation of an ASN.1 module fails if it contains a parameterized type with an inner SEQUENCE containing an extension marker. It might be related to #4514

To Reproduce

CAP-datatypes {itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) umts-network(1) modules(3) cap-datatypes(52) version8(7)}

DEFINITIONS ::= BEGIN

    Digits {PARAMETERS-BOUND : bound} ::= OCTET STRING (SIZE(
	bound.&minDigitsLength .. bound.&maxDigitsLength))

    BasicGapCriteria {PARAMETERS-BOUND : bound} ::= CHOICE {
       calledAddressAndService [29] SEQUENCE {
           calledAddressValue [0] Digits {bound},
           ...
       }
    }

END
erlc asn1/CAP-datatypes.asn1
Internal error: error:function_clause
[{asn1ct_gen,do_gen_record_1,
             [[{'EXTENSIONMARK',11,undefined}]],
             [{file,"asn1ct_gen.erl"},{line,1277}]},
 {asn1ct_gen,do_gen_record_1,1,[{file,"asn1ct_gen.erl"},{line,1290}]},
 {asn1ct_gen,do_gen_record,3,[{file,"asn1ct_gen.erl"},{line,1271}]},
 {asn1ct_gen,gen_record,5,[{file,"asn1ct_gen.erl"},{line,1234}]},
 {asn1ct_gen,gen_record,5,[{file,"asn1ct_gen.erl"},{line,1191}]},
 {asn1ct_gen,pgen_hrltypes,4,[{file,"asn1ct_gen.erl"},{line,1166}]},
 {asn1ct_gen,pgen_hrl,2,[{file,"asn1ct_gen.erl"},{line,1126}]},
 {asn1ct_gen,pgen,3,[{file,"asn1ct_gen.erl"},{line,69}]}]

Expected behavior
If the inner SEQUENCE is broken out into it's own type it compiles. I'm expecting the same behaviour.

CAP-datatypes {itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) umts-network(1) modules(3) cap-datatypes(52) version8(7)}

DEFINITIONS ::= BEGIN

    Digits {PARAMETERS-BOUND : bound} ::= OCTET STRING (SIZE(
	bound.&minDigitsLength .. bound.&maxDigitsLength))

    BasicGapCriteria {PARAMETERS-BOUND : bound} ::= CHOICE {
       calledAddressAndService [29] CalledAddressAndService {bound}
    }

    CalledAddressAndService {PARAMETER-BOUND : bound} ::= SEQUENCE {
           calledAddressValue [0] Digits {bound},
           ...
    }
END

Affected versions
Erlang/OTP 24.0.1 [erts-12.0.1] with asn1-5.0.16

Additional context
For reference the spec ETSI TS 129 078 V15.0.0 have this behaviour (CAMEL Application Part)

@sebastiw sebastiw added the bug Issue is reported as a bug label May 27, 2021
@KennethL KennethL self-assigned this May 28, 2021
@KennethL
Copy link
Contributor

I can confirm that it is the same type of problem as in #4514 and the solution there does not solve all cases. This is nothing new, it is the same behavior in OTP 23 and I suspect all previous OTP versions.

@IngelaAndin IngelaAndin added the team:PO Assigned to OTP team PO label May 28, 2021
KennethL added a commit to KennethL/otp that referenced this issue Jul 14, 2021
KennethL added a commit that referenced this issue Jul 15, 2021
* kenneth/asn1/GH-4902/OTP-17522:
  support extensionmark in nested SEQUENCE in parameterized type GH-4902 OTP-17522
@KennethL
Copy link
Contributor

Solution is now pushed to maint and master. Will be part of next official patch on the 23 track and will be part of OTP 24.1 when it is released in September

IngelaAndin pushed a commit that referenced this issue Jul 22, 2021
* kenneth/asn1/GH-4902/OTP-17522:
  support extensionmark in nested SEQUENCE in parameterized type GH-4902 OTP-17522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug in progress team:PO Assigned to OTP team PO
Projects
None yet
Development

No branches or pull requests

3 participants