Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] master fe195c0: Don't throw for offset a

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 25 Apr 2014 15:13:20 -0700
On Apr 25, 2014, at 2:48 PM, Evan Huus <eapache@xxxxxxxxx> wrote:

> I think conceptually what we need is a way to say "this item isn't
> associated with any bytes at all, so don't do any bounds checks etc".
> Negative offsets are already taken in the general case; do we need to
> special-define a length of -2 for this?

I'd actually like to see lengths become *unsigned*; currently, we need to do some hackery to make sure that

	length = tvb_get_ntohl(tvb, offset);

		...

	offset += 4;

		...

	proto_tree_add_whatever(..., offset, length, ...);

to handle the case where the length has the uppermost bit set.

Perhaps there needs to be a call or calls to add items that don't correspond to packet data; those calls might take neither an offset argument nor a length argument (nor even a tvbuff argument?), and would not do any bounds checking.  Obviously, they'd have to take an argument corresponding to the value of the item.