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

APER segfault #56

Closed
johvik opened this issue Sep 5, 2019 · 8 comments
Closed

APER segfault #56

johvik opened this issue Sep 5, 2019 · 8 comments

Comments

@johvik
Copy link

johvik commented Sep 5, 2019

When using APER in a CHOICE it segfaults on this line (ct may be NULL):

if(aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start))

For example when encoding ChoiceExtended1 in this asn definition:

Enum ::= ENUMERATED { one, two, three, four }

ChoiceExtended1 ::= CHOICE {                                                              
    a Enum,                                                                               
    ...,                                                                                  
    b Enum                                                                                
}
@velichkov
Copy link

Hi @johvik,

Thanks for reporting this problem, could you also provide also xer or aper files for the example asn1 definition and all commands you need to execute to reproduce this segfault.

Do you have plans to work on a fix?

@mouse07410
Copy link
Owner

Let me second this request. @johvik please provide a xer file that demonstrates the problem.

@johvik
Copy link
Author

johvik commented Sep 6, 2019

Here is a sample that reproduces the issue:

#include <ChoiceExtended1.h>
#include <asn_application.h>

int
main()
{
    ChoiceExtended1_t c;
    memset(&c, 0, sizeof(c));
    c.present = ChoiceExtended1_PR_b;
    c.choice.b = Enum_one;

    uint8_t buffer[500];
    asn_encode_to_buffer(NULL,
                         ATS_ALIGNED_BASIC_PER,
                         &asn_DEF_ChoiceExtended1,
                         &c,
                         &buffer,
                         sizeof(buffer));
}

As a temporary workaround I'm using aper_put_nsnnwn from vlm#125. @velichkov I'm afraid I do not have time to make a permanent fix :/

@mouse07410
Copy link
Owner

@johvik thank you for the code example. But it would really help if you could provide XER-encoded data file for the ASN.1 that causes this APER problem.

@johvik
Copy link
Author

johvik commented Sep 6, 2019

Do you mean this?

<ChoiceExtended1>
    <b><one/></b>
</ChoiceExtended1>

@mouse07410
Copy link
Owner

Yes! Thank you!

@mouse07410
Copy link
Owner

I have a preliminary solution, will push later.

@mouse07410
Copy link
Owner

mouse07410 commented Sep 6, 2019

@johvik thank you - you've provided great info that both unambiguously described the bug, and pointed out a likely solution.

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

No branches or pull requests

3 participants