Ethereal-dev: Re: [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: Tomas Kukosa <tomas.kukosa@xxxxxxxxxxx>
Date: Thu, 22 Sep 2005 07:46:05 +0200
I agree.

And the wrong packet will be more visible.
BTW do we have any any exception like "Invalid packet"?

ronnie sahlberg wrote:

i think it would be valid to throw an exception right there when the tag is wrong.

even it the length is correct it is more than likely something is pretty broken anyway so it is unlikely in my opinion that any attempts to try to skip to the next token and continue would work.




On 9/22/05, Guy Harris <gharris@xxxxxxxxx <mailto:gharris@xxxxxxxxx>> wrote:

    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.