jervi
-
2009-07-22
- priority: 5 --> 7
In org.bn.coders.per.PERAlignedDecoder on line 571, the wrong number of trailBits is calculated if the sizeOfString is a multiple of 8 (for instance 8, 16 or 24).
Example: If the length of the BitString is 16 bit, the code "int trailBits = 8 - sizeOfString%8;" will evaluate to 8, but the correct value should be 0, as the length of the BitString should be exactly 2 byte with no trailing bits.
It is easily fixed by the following code:
int trailBits = sizeOfString%8 == 0 ? 0 : 8 - sizeOfString%8;