Wireshark mailing list archives

Re: Why tvb_get_bits() assumes Big Endian?


From: Tomasz Moń <desowin () gmail com>
Date: Thu, 30 Jul 2020 17:55:41 +0200

On Thu, Jul 30, 2020 at 3:35 PM Filipe Laíns <lains () archlinux org> wrote:
For this reason I decided to drop it in favor of tvb_get_bits_array
+ pletoh*. It is simple enough to be used standalone.

This looks like a workaround to me, not a proper solution.

To me the bit level order within a single byte seems clear - it's up
to the tool that provides data to Wireshark to handle it. Wireshark
job starts at the byte (octet) level.

I would actually like to see tvb_get_bits* throw an error
on ENC_LITTLE_ENDIAN as it is clearly not supported.

Yes, it would be better to throw an error than to silently assume Big
Endian. However, the best would be if it simply worked with
ENC_LITTLE_ENDIAN.

In fact, if you check the history, you'll notice that the initial
implementation did call DISSECTOR_ASSERT_NOT_REACHED(); when called
with little endian [1].

[1] https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff;h=b688f9154aacf9c2f30dc6c715bc115a05e9fcef
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: