Wireshark-bugs: [Wireshark-bugs] [Bug 11810] New: Calling plugin_if_goto_frame when there is no

Date: Sun, 29 Nov 2015 18:16:58 +0000
Bug ID 11810
Summary Calling plugin_if_goto_frame when there is no file loaded causes a Protection Exception
Product Wireshark
Version Git
Hardware x86
OS Windows 7
Status UNCONFIRMED
Severity Major
Priority Low
Component Qt UI
Assignee [email protected]
Reporter [email protected]

Build Information:
Version 2.1.0-TmSyncro (v2.1.0rc0-616-gc6b1c9c from unknown)

Copyright 1998-2015 Gerald Combs <[email protected]> and contributors.
License GPLv2+: GNU GPL version 2 or later
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with Qt 5.5.1, with WinPcap (4_1_3), with libz 1.2.8, with
GLib 2.42.0, with SMI 0.4.8, with c-ares 1.9.1, with Lua 5.2, with GnuTLS
3.2.15, with Gcrypt 1.6.2, with MIT Kerberos, with GeoIP, with QtMultimedia,
with AirPcap.

Running on 64-bit Windows 7 Service Pack 1, build 7601, with locale C, with
WinPcap version 4.1.3 (packet.dll version 4.1.0.2980), based on libpcap version
1.0 branch 1_0_rel0b (20091008), with GnuTLS 3.2.15, with Gcrypt 1.6.2, with
AirPcap 4.1.0 build 1622.
Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz (with SSE4.2), with 8082MB of physical
memory.

Built using Microsoft Visual C++ 12.0 build 31101
--
I have written a test plugin that adds a menu item that has a single option to
jump to packet 55 using the Plugin IF function plugin_if_goto_frame.  This
works fine but I noticed that if I call plugin_if_goto_frame before a capture
file is loaded, Wireshark crashes with a Protection Exception.

The problem occurs in the function cf_goto_frame in file.c as follows:

gboolean
cf_goto_frame(capture_file *cf, guint fnumber)
{
  frame_data *fdata;

  fdata = frame_data_sequence_find(cf->frames, fnumber);   // *** problem
occurs here as cf is NULL

  if (fdata == NULL) {
      /* we didn't find a packet with that packet number */
      statusbar_push_temporary_msg("There is no packet number %u.", fnumber);
  .
  .

The fix is relatively simple; change the code to this:

gboolean
cf_goto_frame(capture_file *cf, guint fnumber)
{
  frame_data *fdata;

  if (cf == NULL) {
      /* we don't have a loaded capture file */
      statusbar_push_temporary_msg("There is no file loaded");
      return FALSE;   /* we failed to go to that packet */
  }
  else
  {
      fdata = frame_data_sequence_find(cf->frames, fnumber);
  }

  if (fdata == NULL) {
      /* we didn't find a packet with that packet number */
      statusbar_push_temporary_msg("There is no packet number %u.", fnumber);
  .
  .

I have tested this fix and it works fine.

I've been asked to push the fix to gerrit, which I will do, although this is a
very steep learning curve for me so it may not happen quickly.

Best regards...Paul


You are receiving this mail because:
  • You are watching all bug changes.