Ethereal-dev: [Ethereal-dev] Re: [Ethereal-cvs] rev 13869: /trunk/epan/dissectors/: packet-wsp

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

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Wed, 23 Mar 2005 00:30:34 +0100
obiot@xxxxxxxxxxxx wrote:

>Log:
> As suggested by Ulf Lamping, prevent Ethereal from bailing out if there's a protocol error, as we now have a DISSECTOR_ASSERT() macro.
>  
>
As this is far better than the former implementation, this still doesn't
be the right way to handle this.

If incoming data is wrong, it should be shown as such in the protocol
tree, but not indicating a dissector bug. Not the dissector is buggy,
but the data is (important difference).

In a clean dissector implementation, calling DISSECTOR_ASSERT (and
g_assert) is not required at all. Just don't do: Oh I'm too lazy to
implement this right now, and this might never happen, so I place a
DISSECTOR_ASSERT here.


DISSECTOR_ASSERT's primary goal is to call this in the various support
functions (e.g. proto.c) where the function itself can't do anything
better than call DISSECTOR_ASSERT as the dissector has handed over
garbage parameters.


I'm writing all this, because I'm thinking about a mechanism, to inform
users about this assert problem (e.g. by a dialog window, but this is
not ready for prime time). This should only happen for real
implementation bugs, but not for the laziness of a dissector programmer
at places where it's already visible ;-)

Regards, ULFL