Skip to content

Commit dcf7bf4

Browse files
committed
Fix unintended bit overwriting with sparse bit offsets.
Any bit for which the replacement pattern contained a 1 bit in one of the "holes", would be set despite not being part of the desired mask.
1 parent a0ffffb commit dcf7bf4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

canopen/objectdictionary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def encode_bits(
553553
for bit in bits:
554554
mask |= 1 << bit
555555
temp &= ~mask
556-
temp |= bit_value << min(bits)
556+
temp |= (bit_value << min(bits)) & mask
557557
return temp
558558

559559

0 commit comments

Comments
 (0)