Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000887Taste[All Projects] ASN.1 Compiler v4public2019-11-06 20:242019-11-10 19:27
Assigned Togmamais 
PlatformOSOS Version

Encoding functions assume input buffers are initialised to zero


The bitstream functions in asn1crt.c (e.g. BitStream_AppendByte) use a logical OR to write into the supplied bitstream buffer. If that buffer was previously used to encode a different message, the result is the logical OR of the two messages.

This was an absolute bear to track down. Please fix it soon.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gmamais (developer)
2019-11-07 07:50

Is it possible to call the BitStream_Init() function before starting the encoding process?
Please note that this was a design choice. It is much more efficient to call BitStream_Init  at the beginning to zero the output buffer instead of writing bit zeros in every call BitStream_AppendByte()  and BitStream_AppendPartialByte()

shd01 (reporter)
2019-11-07 08:31

Ah, I see. I can call the BitStream_Init().

shd01 (reporter)
2019-11-07 08:49

But I don't think that zeroing during write is particularly inefficent. Every byte is already accessed at least once, so instead of doing:

a) buf[i] = buf[i] | newbits

you could do:

b) buf[i] = (buf[i] & mask) | newbits

I think you'd be hard-pressed to notice an efficiency difference between the two.

gmamais (developer)
2019-11-07 16:49

You are right. There should no actual difference between the two. It will be implemented the way you propose.

gmamais (developer)
2019-11-10 19:27

fixed in latest GitHub commit (version

- Issue History
Date Modified Username Field Change
2019-11-06 20:24 shd01 New Issue
2019-11-06 21:03 maxime Assigned To

=> gmamais

2019-11-06 21:03 maxime Status

new => assigned

2019-11-07 07:50 gmamais Note Added: 0003663
2019-11-07 08:31 shd01 Note Added: 0003664
2019-11-07 08:36 shd01 Note Added: 0003665
2019-11-07 08:37 shd01 Note Deleted: 0003665
2019-11-07 08:49 shd01 Note Added: 0003666
2019-11-07 16:49 gmamais Note Added: 0003669
2019-11-10 19:27 gmamais Note Added: 0003674
2019-11-10 19:27 gmamais Status

assigned => resolved

2019-11-10 19:27 gmamais Resolution

open => fixed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker