1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-07 03:16:40 -04:00
Files
sdrangel/sdrbase
Robin Getz 742746dc7b Fix undefined shift in SimpleDeserializer::readS32
The signed integer deserialization code used a signed temporary value while
assembling bytes:

    tmp = (tmp << 8) | byte;

For negative values, tmp was initialized to -1 for sign extension, causing a
left shift of a negative value, which is undefined behavior in C++.

Use an unsigned temporary while constructing the 32-bit representation and
convert to qint32 only after all bytes have been assembled. This preserves the
existing two's complement sign handling while avoiding undefined signed shifts.

Fixes static analysis (cppcheck) warning about shifting a negative value.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 15:01:21 -04:00
..
2026-03-25 19:06:11 +00:00
2024-09-05 13:37:46 +03:00
2024-10-21 17:09:32 +01:00