Recommend the expert mechanism, rather than DISSECTOR_ASSERT(), for
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 8 Jul 2009 00:57:01 +0000 (00:57 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 8 Jul 2009 00:57:01 +0000 (00:57 +0000)
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.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29006 f5534014-38df-0310-8fa8-9805f1628bb7

doc/README.developer

index c79703c8bd722ba111c043a3013de23361bf28db..e0530484df5d36f1c37075f33347da787542d2d5 100644 (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