Wireshark-commits: [Wireshark-commits] master 0ea51ad: Qt: Fix uninitialized memory	access in val_u
      
      
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=0ea51ad82256f833a0d93efb16aa4e749c80eb5b
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
0ea51ad by Peter Wu (peter@xxxxxxxxxxxxx):
    Qt: Fix uninitialized memory access in val_units_
    
    Fixes the following UBSAN errors:
    
        ui/qt/io_graph_dialog.cpp:1720:75: runtime error: load of value 3200171710, which is not a valid value for type 'io_graph_item_unit_t'
            #0 0x5611f0b0cd1d in IOGraph::setFilter(QString const&) ui/qt/io_graph_dialog.cpp:1720:75
            #1 0x5611f0b737a1 in IOGraph::IOGraph(QCustomPlot*) ui/qt/io_graph_dialog.cpp:1682:5
            #2 0x5611f0afb3f3 in IOGraphDialog::addGraph(bool, QString, QString, int, IOGraph::PlotStyles, io_graph_item_unit_t, QString, int) ui/qt/io_graph_dialog.cpp:340:24
            #3 0x5611f0af7c19 in IOGraphDialog::IOGraphDialog(QWidget&, CaptureFile&) ui/qt/io_graph_dialog.cpp:289:13
    
        ui/qt/io_graph_dialog.cpp:1818:19: runtime error: load of value 3200171710, which is not a valid value for type 'io_graph_item_unit_t'
            #0 0x5611f0b1167e in IOGraph::setPlotStyle(int) ui/qt/io_graph_dialog.cpp:1818:19
            #1 0x5611f0b062ee in IOGraphDialog::syncGraphSettings(QTreeWidgetItem*) ui/qt/io_graph_dialog.cpp:420:10
    
        ui/qt/io_graph_dialog.cpp:1872:29: runtime error: load of value 3200171710, which is not a valid value for type 'io_graph_item_unit_t'
            #0 0x5611f0b13e6a in IOGraph::setValueUnits(int) ui/qt/io_graph_dialog.cpp:1872:29
            #1 0x5611f0b06640 in IOGraphDialog::syncGraphSettings(QTreeWidgetItem*) ui/qt/io_graph_dialog.cpp:422:10
    
    Note that calling setFilter with an empty string is pretty useless,
    especially since the filter is initialized later, so remove it.
    The choice for IOG_ITEM_UNIT_FIRST is quite arbitrary and needed because
    setValueUnits reads the "old" (uninitialized) value.
    
    Change-Id: I32c65a30593cb718b838c0f324e0d1b0eaab90e5
    Reviewed-on: https://code.wireshark.org/review/20767
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    
Actions performed:
    from  aa6dcf9   Add a bunch of #defines for OSI NSAP AFI values, and use them.
    adds  0ea51ad   Qt: Fix uninitialized memory access in val_units_
Summary of changes:
 ui/qt/io_graph_dialog.cpp |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)