Wireshark-commits: [Wireshark-commits] master 53d8e6d: Lua: fix crash in reloading Lua plugins that

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 29 Dec 2018 10:38:19 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=53d8e6dcf8c639a13f8c52a11df829b854c1b9ac
Submitter: "Peter Wu <peter@xxxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

53d8e6d by Peter Wu (peter@xxxxxxxxxxxxx):

    Lua: fix crash in reloading Lua plugins that use FileHandler
    
    Reloading Lua plugins did not actually remove registered FileHandler
    instances which resulted in a use-after-free of lua_State. Fix this by
    tracking instances and release them in wslua_deregister_filehandlers.
    
    Other required fixes to allow reregistration after reloading:
    - Fix END_FILEHANDLER_ROUTINE not to block all new registrations.
    - wtap file subtypes are apparently persistent, even after
      "unregistering". Fix this by looking up the previous subtype that
      matches the FileHandler short name. Add a small sanity check to
      wtap_register_file_type_subtypes to prevent internal handlers from
      being overwritten.
    
    This patch creates a potential memleak of registered_file_handlers as
    wslua_deregister_filehandlers is not called on program exit (yet?).
    
    Bug: 13264
    Change-Id: I4f5935cde6ff8dc4de333359bad3efca96d4fb9b
    Reviewed-on: https://code.wireshark.org/review/31068
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    

Actions performed:

    from  e1c02bd   Add jsonraw to tshark's -T man page synopsis
     add  53d8e6d   Lua: fix crash in reloading Lua plugins that use FileHandler


Summary of changes:
 epan/wslua/wslua_file_handler.c | 61 +++++++++++++++++++++++++++++------------
 wiretap/file_access.c           | 10 ++++++-
 2 files changed, 52 insertions(+), 19 deletions(-)