Wireshark-bugs: [Wireshark-bugs] [Bug 5575] New: Patch to fix memory leaks/errors in Lua plugin

Date: Tue, 11 Jan 2011 22:36:49 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5575

           Summary: Patch to fix memory leaks/errors in Lua plugin
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: bobby@xxxxxxxxxxxxxxx


Created an attachment (id=5717)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=5717)
Fix memory errors & Lua call-stack unwinding.

Build Information:
wireshark 1.5.0 (SVN Rev 35467 from /trunk)

Copyright 1998-2011 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
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 GTK+ 2.20.1, with GLib 2.24.1, with libpcap
1.0.1_pre20090708, with libz 1.2.3, with POSIX capabilities (Linux), without
libpcre, with SMI 0.4.8, with c-ares 1.6.0, with Lua 5.1, without Python, with
GnuTLS 2.8.1, with Gcrypt 1.4.4, with MIT Kerberos, with GeoIP, with PortAudio
V19-devel (built Jul 30 2009 21:58:27), with AirPcap.

Running on Linux 2.6.36-gentoo, with libpcap version 1.0.1_pre20090708, with
libz 1.2.3, GnuTLS 2.8.1, Gcrypt 1.4.4, without AirPcap.

Built using gcc 4.4.5.
--
I found & fixed a few memory access errors and leaks in the wslua plugin.  Also
the Lua call-stack is not being unwound when a WireShark exception is thrown
during the executation of a Lua dissector.

The attached patch fixes these problems.  To fix the unwinding of the Lua
call-stack when a WireShark exception is thrown, I added support for
pushing/poping "unwinders" functions (these are like the cleanup functions that
are called when an exception is thrown).  The unwinder for Lua intercepts the
thrown exception and then calls lua_error() to make Lua clean-up it's
call-stack, the the WireShark exception is re-thrown.

I also added support for creating a Tvb object from a Lua string, this allows
Lua scripts to do more complex processing (i.e. decompression) of the packet
data without having to work on one byte at a time with get_index()/set_index()
functions.

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.