Wireshark-bugs: [Wireshark-bugs] [Bug 13017] New: Lua dissector crashes on "string.format("%s",

Date: Sat, 15 Oct 2016 00:20:21 +0000
Bug ID 13017
Summary Lua dissector crashes on "string.format("%s", tree.text)"
Product Wireshark
Version 2.2.1
Hardware x86-64
OS Windows 7
Status UNCONFIRMED
Severity Major
Priority Low
Component Dissection engine (libwireshark)
Assignee [email protected]
Reporter [email protected]

Build Information:
Version 2.2.1 (v2.2.1-0-ga6fbd27 from master-2.2)

Copyright 1998-2016 Gerald Combs <[email protected]> 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 REPRODUCE

1. 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 address

ADDITIONAL INFO
The crash happens only when "string.format("%s", tree.text)" is present in the
code. Additionally, changing "tree.text" to anything else fixes the crash.


You are receiving this mail because:
  • You are watching all bug changes.