Wireshark-commits: [Wireshark-commits] master-2.2 b5ee450: Qt: fix crash on clearing dfilter after
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 21 Sep 2016 20:42:30 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=b5ee450455e312146abe99a19d84d501902db080
Submitter: Alexis La Goutte (alexis.lagoutte@xxxxxxxxx)
Changed: branch: master-2.2
Repository: wireshark

Commits:

b5ee450 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.
    
    Bug: 12929
    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>
    (cherry picked from commit b6f73f2567854b1ea417957d7ea5de32b1989aa3)
    Reviewed-on: https://code.wireshark.org/review/17844
    Reviewed-by: Pascal Quantin <pascal.quantin@xxxxxxxxx>
    Petri-Dish: Pascal Quantin <pascal.quantin@xxxxxxxxx>
    Reviewed-by: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
    

Actions performed:

    from  61ad380   dmp: Restore checksum incorrect info
    adds  b5ee450   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(-)