Closed oaitamrane closed 6 years ago
@oaitamrane this is the code I am using right now, constr_SEQUENCE.c at line 1320:
if(edx != (td->elements_count-1))
{
if(!edx && specs->roms_count && (padding > 0))
ASN_DEBUG(">>>>> not getting padding of %d bits for element:%d out of %d (specs->roms_count:%d)", padding, edx, td->elements_count, specs->roms_count);
else
per_get_few_bits(pd, padding);
}
else //
{
if(specs->roms_count && (padding > 0))
ASN_DEBUG(">>>>> not getting padding of %d bits for element:%d out of %d (specs->roms_count:%d)", padding, edx, td->elements_count, specs->roms_count);
else
per_get_few_bits(pd, padding);
}
I didn't report it in the previous issue cause I honestly don't remember the context of that fix. Anyway, you can try it and see if it solves your problem
@mhanna123 Unfortuantely your proposed patch did not solve the problem. Can you execute the small program I sent you.
@oaitamrane
in constr_SEQUENCE.c, at line 1324 or in the code in my previous comment, change
if(!edx && specs->roms_count && (padding > 0))
with
if( (edx < specs->roms_count) && (padding > 0))
@oaitamrane and @mhanna123 can you post here sample data for Request-Type.asn
? I'd like to check whether the current vlm_master
branch resolves this problem.
Actually, my tests show that the current vlm_master
branch resolves this issue. Please post here or re-open if you have additional info or problems.
These are my test-cases:
Request-Type.asn
-- **************************************************************
--
-- Common definitions
--
-- **************************************************************
Messages
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
-- **************************************************************
--
-- Request Type
--
-- **************************************************************
RequestType ::= SEQUENCE {
event RequestTypeEvent,
reportArea RequestTypeReportArea,
horizontalaccuracyCode RequestTypeAccuracyCode OPTIONAL,
iE-Extensions NULL OPTIONAL,
...
}
RequestTypeEvent ::= ENUMERATED {
stop-change-of-service-area,
direct,
change-of-service-area,
stop-direct,
...,
periodic,
stop-periodic
}
RequestTypeReportArea ::= ENUMERATED {
service-area,
geographical-area,
...
}
RequestTypeAccuracyCode ::= INTEGER (0..127)
END
sample.xer
:
<RequestType>
<event><direct/></event>
<reportArea><geographical-area/></reportArea>
<horizontalaccuracyCode>31</horizontalaccuracyCode>
</RequestType>
sample2.xer
:
<RequestType>
<event><direct/></event>
<reportArea><geographical-area/></reportArea>
<iE-Extensions></iE-Extensions>
</RequestType>
@mouse07410 , @mhanna123 I am using the version https://github.com/mouse07410/asn1c.git suggested by @mouse07410 to encode/decode APER PDUs. I have performed a basic test with a SEQUENCE with Extension Marker contains 2 MANDATORY ENUMS with Extension Marker and 2 OPTIONAL Parameters that are not Present. All the SEQUENCE Parameters are in the Extension Root. Encoding is successful, but decoding fails. When debugging I have located a problem in SEQUENCE_decode_aper() function in constr_SEQUENCE.c dealing withe padding. After decoding the Extension Marker of the SEQUENCE (1bit) and the 2 Optional Parameters Indicators (2bits) decoding procedure assumes padding of 5 bits before the Extension Marker of the 1st ENUM while there should be no padding in this situation. I think that this problem has been addressed by @mhanna123 but he did not solve it completely. I attach a basic code to test this. Thank you in advance RequestType.ZIP