Wireshark-commits: [Wireshark-commits] master 4f3646f: Fix handling of invalid UAT items

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 15 Feb 2015 23:52:28 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=4f3646fe62244f7aba3f309c509c3414f1028650
Submitter: Michael Mann (mmann78@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

4f3646f by Peter Wu (peter@xxxxxxxxxxxxx):

    Fix handling of invalid UAT items
    
    If the UAT file failed a field check, then the user_data pointer may be
    empty. As a result uat_save() triggers an invalid write.
    
    (Discovered while working with a dfilter_macros file having duplicate
    names for bug 10957, caught by ASAN.)
    
    The second issue fixed in this patch is that the validity of an item is
    only calculated when a new record is added. So even if the user edits
    the UAT and makes the entry valid, it would not be saved. This is solved
    by adding a new uat_update_record() function which got wires up into GTK
    and Qt.
    
    Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also
    converted.
    
    Even after this patch, Qt has some issues with UAT handling. In
    particular, it saves new, but empty/invalid, items. It also it does not
    check individual fields when saving all fields (unlike Gtk). This patch
    focused on getting Gtk fixed first so ignores those existing issues.
    
    Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99
    Reviewed-on: https://code.wireshark.org/review/7120
    Petri-Dish: Michael Mann <mmann78@xxxxxxxxxxxx>
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Michael Mann <mmann78@xxxxxxxxxxxx>
    

Actions performed:

    from  f5902a6   Fix duplicate Display Filter Macro check
    adds  4f3646f   Fix handling of invalid UAT items


Summary of changes:
 debian/libwireshark0.symbols |    1 +
 epan/uat-int.h               |    3 +++
 epan/uat.c                   |   31 ++++++++++++++++++++++++++-----
 ui/gtk/uat_gui.c             |    2 ++
 ui/qt/uat_dialog.cpp         |    4 ++++
 5 files changed, 36 insertions(+), 5 deletions(-)