ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] BCD Decoding

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Wed, 18 Dec 2013 00:13:08 +0100
Hi Even,

in 3GPP world BCD encoding starts with the least significant nibble. That's why tvb_bcd_dig_to_wmwm_packet_str() behaves like this. Changing it to decode the most significant nibble first would break all the dissectors currently using this function.
The "stop condition" for the most significant nibble set to 0xf is just to detect the filler digit in case you have an odd number of digits. In case of even number, the length itself is sufficient and you do not need a filler, so no "stop condition" is required.

Regards,
Pascal.



2013/12/17 Evan Huus <eapache@xxxxxxxxx>
Alexis's ASAN build recently caught an error in
tvb_bcd_dig_to_wmem_packet_str in which it appears that if the least
significant nibble of the decoded byte is 0xf then we read one element
past the end of the 14-element digit array.

If the most significant nibble is 0xf we treat that as a stop
condition. Is the correct approach to treat a least significant nibble
of 0xf as a stop condition also?

While in the neighbourhood - shouldn't we be decoding the more
significant nibble first, not second? Wiki states that most BCD
implementations are big-endian...

Cheers,
Evan
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe