Build Information:
Version 2.2.1 (v2.2.1-0-ga6fbd278 from master-2.2)
Copyright 1998-2016 Gerald Combs <gerald@wireshark.org> and contributors.
License GPLv2+: GNU GPL version 2 or later <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiled (64-bit) with Qt 5.6.1, with WinPcap (4_1_3), with GLib 2.42.0, with
zlib 1.2.8, with SMI 0.4.8, with c-ares 1.12.0, with Lua 5.2.4, with GnuTLS
3.2.15, with Gcrypt 1.6.2, with MIT Kerberos, with GeoIP, with QtMultimedia,
with AirPcap.
Running on 64-bit Windows 7 Service Pack 1, build 7601, with locale
Polish_Poland.1250, with WinPcap version 4.1.3 (packet.dll version 4.1.0.2980),
based on libpcap version 1.0 branch 1_0_rel0b (20091008), with GnuTLS 3.2.15,
with Gcrypt 1.6.2, without AirPcap.
Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz (with SSE4.2), with 8169MB of
physical memory.
Built using Microsoft Visual C++ 12.0 build 40629
It seems that using string.format with contents of TreeItem.text causes a memory access violation.HOW TO REPRODUCE1. Add this Lua dissector to Wireshark: local proto = Proto("proto", "Protocol") function proto.dissector(buffer, pinfo, tree) string.format("%s", tree.text) end local udp_table = DissectorTable.get("udp.port") udp_table:add(12345, proto)2. Start listening on arbitrary interface and send an UDP packet through it, with destination port = 12345.3. Wireshark will print following message on the console:01:51:03 Warn Dissector bug, protocol PROTO, in packet 16: STATUS_ACCESS_VIOLATION: dissector accessed an invalid memory addressADDITIONAL INFOThe crash happens only when "string.format("%s", tree.text)" is present in the code. Additionally, changing "tree.text" to anything else fixes the crash.
(In reply to Jaap Keuter from comment #1) > See the very last section (2.11) of README.dissector[1], which states that > tree may be NULL and your code has to work either way. > > [1] > https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=doc/ > README.dissector This README is for writing dissectors in C, not Lua. Even if you would pass `nil` to string.format that doesn't cause a crash in standard Lua interpreter. The bug here seems to break Lua safety - you can't dereference invalid pointer in Lua, this is only possible when there's a bug in its engine or in Wireshark's extensions.