Ethereal-dev: [Ethereal-dev] Should the BER dissector throw an exception on a tag mismatch?

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, 21 Sep 2005 18:27:30 -0700 (PDT)
Currently, the BER dissector will put a "BER Error" item into the protocol
tree if it is attempting to dissect an item of a particular type but the
tag on the item says it has another type.  It returns an offset that runs
past the end of the item after that.

This means that, for example, callers to dissect_ber_octet_string() who
pass it a tvbuff_t ** have to check whether the tvbuff_t * returned is
null, which it will be if the item didn't have a tag  appropriate to an
octet string.  I've checked in a bunch of changes to add checks for that.

Should we, for any or all of the cases where a "BER Error" item is
currently put into the protocol tree, be throwing an exception and giving
up on dissection?  One could argue that, if the tag is wrong but the
length is correct, *not* throwing an exception lets us try dissecting more
of the packet.