mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-11 14:03:56 -04:00
ee24189bd2
The HDLC encoder accumulated bits into m_bits using the |= operator without first initializing the first byte. This resulted in an uninitialized read of m_bits[0] when encoding the first bit of a packet. Initialize each output byte when writing its first bit, ensuring the buffer contains a defined value before bits are OR'ed into it. This also makes addBit() self-contained, eliminating the need for callers to pre-initialize the current output byte. Reported by Coverity. Signed-off-by: Robin Getz <rgetz503@gmail.com>