Wireshark-commits: [Wireshark-commits] master b6f73f2: Qt: fix crash on clearing dfilter after capt
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 18 Aug 2016 04:30:25 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=b6f73f2567854b1ea417957d7ea5de32b1989aa3
Submitter: Anders Broman (a.broman58@xxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

b6f73f2 by Peter Wu (peter@xxxxxxxxxxxxx):

    Qt: fix crash on clearing dfilter after capture restart
    
    Since v2.1.2rc0-1-gaf5daa6 ("Qt: Replace a QMap with a QVector."), the
    following error could be observed:
    
        ASSERT failure in QVector<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qvector.h, line 433
        Aborted (core dumped)
    
    It happens when a capture filter is present and a live capture is
    restarted. Then the number_to_row_ structure would be truncated which
    results in an invalid access.
    
    Fix this by always checking the length before inserting a new mapping.
    Do it inside the loop to prevent an unlikely race condition where more
    than 10000 packets are received before the next iteration.
    
    Store "row number + 1" to avoid having to initialize the new elements
    from resize() with -1, the default value is 0 which is good now.
    
    Change-Id: I88ce955a3551508e773eeadddc6f89bbb583acaf
    Reviewed-on: https://code.wireshark.org/review/17111
    Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  3c8f657   ISAKMP: Fix Result of operation is garbage or undefined found by Clang Analyzer
    adds  b6f73f2   Qt: fix crash on clearing dfilter after capture restart


Summary of changes:
 ui/qt/packet_list_model.cpp |   36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)