ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [ethereal-dev] segmentation fault

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Wed, 29 Dec 1999 13:30:49 -0800
> I produced a segmentation fault with ethereal  on a multiprocesor
> system.

OK, I've checked in a fix to keep us from trying to compute, in the
summary, any data that requires that we look at the first packet in the
capture, if there are no packets in the capture.

That'll probably fix the bug in question; the fix should show up in the
next release.  I've attached a patch to the Ethereal 0.7.9 source that
should fix the problem.

Workaround: don't run "Tools:Summary" unless there's at least one packet
displayed in the packet list.
*** ethereal-0.7.9/summary.c	Mon Oct 11 21:55:02 1999
--- ethereal-0.7.9.fixed/summary.c	Wed Dec 29 13:28:52 1999
***************
*** 128,142 ****
   double         seconds;
   frame_data    *cur_glist;
  
   /* initialize the tally */
    first_frame = cf.plist;
-   st = (summary_tally *)g_malloc(sizeof(summary_tally));
    st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) 
  ;
    st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) 
  ;
-   st->bytes = 0;
-   st->filtered_count = 0;
    cur_glist = cf.plist;
  
    for (i = 0; i < cf.count; i++){
--- 128,146 ----
   double         seconds;
   frame_data    *cur_glist;
  
+  st = (summary_tally *)g_malloc(sizeof(summary_tally));
+  st->start_time = 0;
+  st->stop_time = 0;
+  st->bytes = 0;
+  st->filtered_count = 0;
+ 
   /* initialize the tally */
+  if (cf.plist != NULL) {
    first_frame = cf.plist;
    st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) 
  ;
    st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) 
  ;
    cur_glist = cf.plist;
  
    for (i = 0; i < cf.count; i++){
***************
*** 144,149 ****
--- 148,154 ----
      tally_frame_data(cur_frame, st);
      cur_glist = cur_glist->next;
    }
+  }
  
    /* traffic_bytes will be computed here */
    traffic_bytes = st->bytes;