epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

Truncation in BitSet::or_and() #27

Closed mdavidsaver closed 8 years ago

mdavidsaver commented 8 years ago

For "this |= set1 & set2" the result size should be "max(this, min(set1, set2))" while previously it was "min(set1, set2)" resulting in truncation if the LHS is longer than the RHS.

Practically this can lead to truncation of the overflow bit set, clearing bits which were previously set.

As the fix is straightforward I've already pushed d4292d81f2391a5bb5e5747f0f6ceacec028c1e2 along with an added test case.

The bug was present in the initial implementation.

mdavidsaver commented 8 years ago

@dhickin How do you want to track fixes which should go into a bug fix release?

msekoranja commented 8 years ago

+1 on a fix.

dhickin commented 8 years ago

Fixed by d4292d81f2391a5bb5e5747f0f6ceacec028c1e2