Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000821Taste[All Projects] ASN.1 Compiler v4public2018-12-11 17:312019-01-12 16:30
Reportercavada@fbk.eu 
Assigned Togmamais 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusassignedResolutionopen 
PlatformOSOS Version
Summary0000821:

Wrong encoding for enumerated values

Description

In this example:

T-Packet []
{
nid T-NID-Packet [encode-values],
length NULL [pattern '0000000000000'B], -- 13 bits

pbody [determinant nid]
}

nid is used as determinant for choice pbody. Notice that is it essential that nid get encoded with its value, and not packed with base 0 (which should be ensured by encode-values

The encoding/decoding code is almost ok, as all needed structures are created to preserve enumerative values.

However, when encoding the enumerative value, this call is done:
BitStream_EncodeConstraintPosWholeNumber(pBitStrm, intVal, 13, 15);

here min=13 and max=15 come from the definition of T-NID-Packet, which at the moment is limited to two entries:

T-NID-Packet ::= ENUMERATED
{
stm-13 (13),
stm-15 (15)
}

With min=13, stm-13 will be encoded with 0 (instead of 13), and stm-15 with 2 (instead of 15).

Steps To Reproduce

See attached archive for a complete example.

TagsNo tags attached.
Attached Filestgz file icon test-asn.tgz [^] (3,362 bytes) 2018-12-11 17:31

- Relationships

-  Notes
(0003556)
gmamais (developer)
2019-01-12 16:30

You should change then ACN encoding spec of nid
instead of :

nid T-NID-Packet [encode-values]

you should write :

nid T-NID-Packet [encode-values, size 4, encoding pos-int]

If you don't provide the encoding property the ASN.1 Compiler will use the uPER encoding and that's why you get the call to
BitStream_EncodeConstraintPosWholeNumber(pBitStrm, intVal, 13, 15);

If you are OK with that please close the ticket.


- Issue History
Date Modified Username Field Change
2018-12-11 17:31 cavada@fbk.eu New Issue
2018-12-11 17:31 cavada@fbk.eu File Added: test-asn.tgz
2018-12-13 08:13 maxime Assigned To

=> gmamais

2018-12-13 08:13 maxime Status

new => assigned

2019-01-12 16:30 gmamais Note Added: 0003556


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker