From 68585cac68f752d505631c1852703bfefea591c7 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:09:26 -0400 Subject: [PATCH] modemdab: Avoid Coverity overflow warning in CRC16 Fix Coverity CID 657927 by explicitly limiting the complemented CRC to 16 bits using XOR with 0xffff. This avoids the reported overflow when returning the complemented value as uint16_t. Signed-off-by: Robin Getz --- modemdab/dabtables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modemdab/dabtables.cpp b/modemdab/dabtables.cpp index 09b463ec5..896ac7605 100644 --- a/modemdab/dabtables.cpp +++ b/modemdab/dabtables.cpp @@ -446,7 +446,7 @@ uint16_t DABTables::crc16(const uint8_t *data, std::size_t length) crc = (crc & 0x8000) ? static_cast((crc << 1) ^ 0x1021) : static_cast(crc << 1); } } - return static_cast(~crc); + return static_cast(~crc ^ 0xffff); } bool DABTables::crc16Check(const uint8_t *data, std::size_t lengthWithCRC)