Ethereal-dev: [Ethereal-dev] Re: [Ethereal-cvs] rev 14203: /trunk/epan/: proto.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Wed, 27 Apr 2005 11:04:00 -0700
gerald@xxxxxxxxxxxx wrote:
User: gerald
Date: 2005/04/27 11:22 AM

Log:
 In alloc_field_info, throw a ReportedBoundsError if we're passed an
 invalid length.

In practice, a negative (probably meaning very large positive) length would be beyond the packet length in almost all cases, but it might be a bit cleaner to use "tvb_ensure_bytes_exist()" to have it throw the appropriate exception.

BTW, the only reason I can see why length arguments to tvbuff and proto_ calls are signed, rather than unsigned, is to support -1 meaning "to the end of the data". We might, instead, want to have separate APIs for that case, e.g. "tvb_new_subset_to_end()", "proto_tree_add_item_to_end()", etc., and make the length arguments unsigned.