Recommend the expert mechanism, rather than DISSECTOR_ASSERT(), for

checks that really check whether the packet is valid; DISSECTOR_ASSERT()
should only be used for cases where the dissector is making an
assumption about its internal state.

svn path=/trunk/; revision=29006
This commit is contained in:
Guy Harris 2009-07-08 00:57:01 +00:00
parent 98c1ca42c9
commit d5289354ab
1 changed files with 9 additions and 2 deletions

View File

@ -528,8 +528,15 @@ Do *NOT* use "g_assert()" or "g_assert_not_reached()" in dissectors.
that it's a problem with the dissector if found; if it cannot do
anything else with a particular value from a packet's data, the
dissector should put into the protocol tree an indication that the
value is invalid, and should return. You can use the DISSECTOR_ASSERT
macro for that purpose.
value is invalid, and should return. The "expert" mechanism should be
used for that purpose.
If there is a case where you are checking not for an invalid data item
in the packet, but for a bug in the dissector (for example, an
assumption being made at a particular point in the code about the
internal state of the dissector), use the DISSECTOR_ASSERT macro for
that purpose; this will put into the protocol tree an indication that
the dissector has a bug in it, and will not crash the application.
If you are allocating a chunk of memory to contain data from a packet,
or to contain information derived from data in a packet, and the size of