there's three coverity defects about division by zero in ui/cli/tap-iostat.c,
function iostat_packet()
This can be triggered from the command line
martin@greta# ./tshark -z io,stat,0.2,AVG\(frame.number\)
Capturing on eth0
Floating point exception
it->num is 0, wireshark crashes in
parent->max_vals[it->colnum] =
MAX(parent->max_vals[it->colnum], it->counter/it->num);
(and similar for other data types)
My proposal for a fix is to not update parent->max_vals[it->colnum] when
it->num==0, see the attached patch.
svn path=/trunk/; revision=42952
Bugs in the tshark '-z io,stat' output:
1: The LOAD stat in the last row of the output is inaccurate because rpc.time
is divided by the full interval rather than limiting it to the capture
duration.
2: An The empty comma field (for outputting total frames and bytes) is ignored
when it is the first field in the command.
3: Intervals at the end of capture that contain no data are not displayed. Such
intervals are as important to see as those (zero data intervals) that occur
earlier in the capture.
4: Floating point numbers are not properly aligned under their column headers.
Enhancements to '-z io,stat' output:
1. Column widths are determined by the maximum magnitude of their values rather
than set to a fixed width of 15 chars which allows for more stats to be
displayed per row without wrapping.
2. To improve readability, filters wrap at 102 chars or the table width,
whichever is greater, and wrap on the nearest space. An option can be added to
alter the 102-char limit.
3. Column numbers begin at 1 instead of 0.
4. The columns and entire output are enclosed in a border for improved
presentability in reports. The table can be imported into a spreadsheet by
specifying the vertical bar as the data delimiter.
"Fixed" compiling on Ubuntu
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6883
svn path=/trunk/; revision=41355
tap-iostat.c: In function ‘iostat_draw’:
tap-iostat.c:542:5: error: implicit declaration of function ‘itoa’
tap-iostat.c:756:9: error: too few arguments for format
tap-iostat.c:756:9: error: too few arguments for format
itoa() could be converted into a g_snprintf(), but the buffer used is only
one character long. Is that right?
For the printf() format one, I'm not sure what was intended.
svn path=/trunk/; revision=41234