ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] failed assertion after returning from nested lua dissector (wire

From: David Gutzmann <gutzmann@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Jul 2009 23:42:23 +0200
I'm trying to write a bunch of small dissectors in lua for a custom protocol (http://www.des-testbed.net/DES-SERT).

A DES-SERT message consists of a header and within the header there are several user defined extension. Therefore i wrote a dissector in lua for the message header itself and as long as no other dissectors get involved everything is fine.

The idea was to let users register their extension-dissectors with the main DES-SERT dissector and then hand of dissection of the extensions to them.

The problem is, that right after the first user dissector returned i get this error:

[Dissector bug, protocol DESSERT: tvbuff.c:665: failed assertion "tvb && tvb->initialized"]

After this, no more item are added to the tree, but i see debug output from the remaining user dissectors on the console. (also weird but maybe not related, the main dissector seems to be called twice...)

The users register their extension dissectors with the following function:

  function dessert_register_ext_dissector(ext_type, ext_name, dissector)
	extension_types[ext_type] = ext_name
	dessert_dissector_table:add(ext_type, dissector)
  end

The main-dissector hands off extensions with:


  -- extlen includes the 2byte extension header!
  extdata_real_length = extlen:uint() - 2
  extdata = buffer(offset, extdata_real_length)

  dissector = dessert_dissector_table:get_dissector(exttype:uint())
  if dissector ~= nil then
    dissector:call(extdata:tvb(), pinfo, exttreeitem)
  end


I really appreciate any comments/ideas you may have on this!

Please let me know if you need additional information (the actual lua scripts pcaps, ...)

Thanks!

David

--
David Gutzmann