aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2020-02-14 18:15:36 +0100
committerAnders Broman <a.broman58@gmail.com>2020-02-15 11:08:44 +0000
commit2c1d660940f04aa44e5966418e7e828d790d3a5a (patch)
tree3f97fe69c229f6089bacad3cc8474489a111477a
parente30f0d09208b01a7dd3d685b612110d16683f045 (diff)
Qt: Access I/O Graph settings via UAT interface
All I/O Graph instances share the same configuration. The code was accessing the UAT underlying number of items variable (num_io_graphs_) directly but the actual rows were accessed indirectly via UAT interface. This could lead to UAT missynchronization and in turn an out of range index access in IOGraphDialog::createIOGraph(). Fix the issue by not using the num_io_graphs_ directly. Bug: 16373 Change-Id: Ifbc0fddb619d23f31f32aa46c4ae613954a8b780 Reviewed-on: https://code.wireshark.org/review/36106 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/qt/io_graph_dialog.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index e763978db5..f62bd9e6a3 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -401,20 +401,20 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf, QString displayFi
loadProfileGraphs();
bool filterExists = false;
- if (num_io_graphs_ > 0) {
- for (guint i = 0; i < num_io_graphs_; i++) {
+ if (uat_model_->rowCount() > 0) {
+ for (int i = 0; i < uat_model_->rowCount(); i++) {
createIOGraph(i);
if (ioGraphs_.at(i)->filter().compare(displayFilter) == 0)
filterExists = true;
}
if (! filterExists && displayFilter.length() > 0)
- addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(num_io_graphs_),
+ addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(uat_model_->rowCount()),
IOGraph::psLine, IOG_ITEM_UNIT_PACKETS, QString(), DEFAULT_MOVING_AVERAGE);
} else {
addDefaultGraph(true, 0);
addDefaultGraph(true, 1);
if (displayFilter.length() > 0)
- addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(num_io_graphs_),
+ addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(uat_model_->rowCount()),
IOGraph::psLine, IOG_ITEM_UNIT_PACKETS, QString(), DEFAULT_MOVING_AVERAGE);
}