Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000890Taste[All Projects] ASN.1 Compiler v4public2019-11-09 17:152019-11-16 15:01
Reportershd01 
Assigned Togmamais 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Summary0000890:

nCount field not initialised in fixed-size subtype

Description

When a fixed size subtype is defined from a variable-size parent, the C structure that is generated contains an "nCount" field, but that field is not initialised by the ACN decoding function.

For example...


Test DEFINITIONS ::=
BEGIN

MyType ::= SEQUENCE (SIZE(1..128)) OF INTEGER
MySubtype ::= MyType(SIZE(4))

END

...generates this code:


///////// test.h
typedef struct {
int nCount;

asn1SccSint arr[128];

} MyType;

typedef MyType MySubtype;

///////// test.c
flag MySubtype_ACN_Decode(MySubtype* pVal, BitStream* pBitStrm, int* pErrCode)
{
flag ret = TRUE;
int i1;

for(i1=0; (i1 < (int)4) && ret; i1++) 
{
    ret = BitStream_DecodeUnConstraintWholeNumber(pBitStrm, (&(pVal->arr[i1])));   
    *pErrCode = ret ? 0 : ERR_ACN_DECODE_MYSUBTYPE_ELM;                               
}

return ret && MySubtype_IsConstraintValid(pVal, pErrCode);

}

I think it would be preferable (and more defensive) to set the value of nCount, particularly if it is possible that a variable of the subtype might be assigned to a variable of the parent type in user code.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0003681)
gmamais (developer)
2019-11-16 15:00

fixed in latest GitHub commit


- Issue History
Date Modified Username Field Change
2019-11-09 17:15 shd01 New Issue
2019-11-09 17:17 maxime Assigned To

=> gmamais

2019-11-09 17:17 maxime Status

new => assigned

2019-11-16 15:00 gmamais Note Added: 0003681
2019-11-16 15:00 gmamais Status

assigned => resolved

2019-11-16 15:00 gmamais Resolution

open => fixed



Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker