Thou shalt not g_assert() in a dissector.

svn path=/trunk/; revision=13875
This commit is contained in:
Guy Harris 2005-03-23 02:48:47 +00:00
parent d4d1206ad5
commit 5a6cf59062
1 changed files with 7 additions and 0 deletions

View File

@ -323,6 +323,13 @@ packets without crashing or looping infinitely.
Here are some suggestions for making dissectors more robust in the face Here are some suggestions for making dissectors more robust in the face
of incorrectly-formed packets: of incorrectly-formed packets:
Do *NOT* use "g_assert()" or "g_assert_not_reached()" in dissectors.
*NO* value in a packet's data should be considered "wrong" in the sense
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.
If you are allocating a chunk of memory to contain data from a packet, 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 or to contain information derived from data in a packet, and the size of
the chunk of memory is derived from a size field in the packet, make the chunk of memory is derived from a size field in the packet, make