Skip to content

PER_ALIGNED is used incorrectly

Summary

PER_ALIGNED is used incorrectly in several places

Steps and/or TTCN-3 code to reproduce

In several places, the expression (p_options && PER_ALIGNED) is used. Using logical && with a constant operand is incorrect. The value of PER_ALIGNED is 0x01, so this expression is true if p_options is not zero. Bitwise & was likely intended.

What is the current bug behavior?

Aligned PER encoding will be used when canonical PER is requested.

What is the expected correct behavior?

Aligned PER encoding not used when only canonical PER is requested.

Relevant logs and/or screenshots

Possible fixes

Change (p_options && PER_ALIGNED) to (p_options & PER_ALIGNED)

core/Bitstring.cc:1432
core/Bitstring.cc:1484
core/Charstring.cc:1980
core/Charstring.cc:2333
core/Octetstring.cc:1549
core/Octetstring.cc:1594
core/Universal_charstring.cc:3297
core/Universal_charstring.cc:3371

Titan version

Commit 129c715f

Platform details (OS type and version)

Any

/cc @aknappqwt @mmagyari

Edited by Csaba Ráduly