summaryrefslogtreecommitdiff
path: root/ui/gtk/io_stat.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-04-16 16:16:15 +0000
committerEvan Huus <eapache@gmail.com>2013-04-16 16:16:15 +0000
commitf8f078744b436bdda2834a807cc2007ec781556b (patch)
tree93278da6425fd47d612935e6f4375d7b618bbdfc /ui/gtk/io_stat.c
parent10b150f49c1062bc4885963f8f48fccfd574d239 (diff)
downloadwireshark-f8f078744b436bdda2834a807cc2007ec781556b.tar.gz
Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8583
IO graph was misbehaving if the packets covered too much real time. It's still ungodly slow, but at least it seems to work. svn path=/trunk/; revision=48882
Diffstat (limited to 'ui/gtk/io_stat.c')
-rw-r--r--ui/gtk/io_stat.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/gtk/io_stat.c b/ui/gtk/io_stat.c
index 0d35cabb17..78f243745f 100644
--- a/ui/gtk/io_stat.c
+++ b/ui/gtk/io_stat.c
@@ -506,6 +506,9 @@ get_it_value(io_stat_t *io, int graph, int idx)
io_item_t *it;
guint32 interval;
+ g_assert(graph < MAX_GRAPHS);
+ g_assert(idx < NUM_IO_ITEMS);
+
it = (io_item_t *)io->graphs[graph].items[idx];
switch (io->count_type) {
@@ -740,6 +743,17 @@ static void
((cfile.elapsed_time.nsecs+500000)/1000000) +
io->interval);
io->max_interval = (io->max_interval / io->interval) * io->interval;
+ if (io->max_interval >= NUM_IO_ITEMS * io->interval) {
+ /* XXX: Truncate the graph if it covers too much real time, as
+ * otherwise we crash later trying to make the graph too wide. There's
+ * no good way of warning the user, since this gets recalculated a
+ * lot and any dialogue we pop up would spawn 100+ times when scrolling.
+ *
+ * Should at least stop us from crashing in:
+ * https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8583
+ */
+ io->max_interval = (NUM_IO_ITEMS - 1) * io->interval;
+ }
/*
* Find the length of the intervals we have data for
* so we know how large arrays we need to malloc()