mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-17 08:14:07 -04:00
adsb: fix BDS 2,1 registration character decoding
Fix an incorrect bit shift when decoding aircraft registration markings from BDS 2,1 Comm-B messages. Coverity (CID 649088) reported that the expression '(data[7] & 0x1) >> 3' always evaluates to zero, causing one bit of the 6-bit character value to be discarded. The BDS 2,1 aircraft registration marking format encodes seven 6-bit characters. Based on the bit layout defined in ICAO Doc 9871 (Technical Provisions for Mode S Specific Services) and verified against independent implementations such as pyModeS/rs1090, the remaining bit from data[7] is the most significant bit of the character and must be shifted left, not right. Update the extraction to preserve this bit when combining it with the remaining bits from data[8]. Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
@@ -3899,7 +3899,7 @@ void ADSBDemodGUI::decodeCommB(const QByteArray data, const QDateTime dateTime,
|
||||
c[2] = ((data[5] & 0x7) << 3) | ((data[6] >> 5) & 0x7);
|
||||
c[3] = ((data[6] & 0x1f) << 1) | ((data[7] >> 7) & 0x1);
|
||||
c[4] = ((data[7] >> 1) & 0x1f);
|
||||
c[5] = ((data[7] & 0x1) >> 3) | ((data[8] >> 3) & 0x1f);
|
||||
c[5] = ((data[7] & 0x1) << 5) | ((data[8] >> 3) & 0x1f);
|
||||
c[6] = ((data[8] & 0x7) << 3) | ((data[9] >> 5) & 0x7);
|
||||
// Map to ASCII
|
||||
for (int i = 0; i < 7; i++) {
|
||||
|
||||
Reference in New Issue
Block a user