1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-06 19:06:30 -04:00
Files
sdrangel/plugins
Robin Getz 5df5469cc2 leansdr : Fix undefined shift behavior in GF(2^N) arithmetic
The gf2n implementation used a left shift on a potentially negative
value when masking field elements:

    (~(Te)0) << N

This can result in undefined behavior for signed integer types and was
reported by static analysis (cppcheck).

Require the field element type to be unsigned and replace the mask
generation with an explicit N-bit mask constructed from the element type.
Also make the overflow check use the element type to avoid implicit
signed integer operations.

Add comments documenting the packed polynomial representation and the
GF(2^N) reduction steps to clarify the intent of the bit operations.

Fixes static analysis warning about shifting negative values.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 14:49:19 -04:00
..
2026-05-04 06:00:17 +02:00