Wireshark-bugs: [Wireshark-bugs] [Bug 3279] New: mergecap doesn't work on amd64 platform

Date: Tue, 24 Feb 2009 07:14:53 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3279

           Summary: mergecap doesn't work on amd64 platform
           Product: Wireshark
           Version: 1.0.6
          Platform: PC
        OS/Version: OpenBSD
            Status: NEW
          Severity: Normal
          Priority: Medium
         Component: Extras
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: bugzilla.wireshark@xxxxxxxxxxxxx


Build Information:
TShark 1.0.6

Copyright 1998-2009 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
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 with GLib 2.18.4, with libpcap 0.5, with libz 1.2.3, without POSIX
capabilities, with libpcre 7.8, without SMI, without ADNS, without Lua, with
GnuTLS 2.6.2, with Gcrypt 1.4.3, with Heimdal Kerberos.

Running on OpenBSD 4.5, with OpenBSD libpcap.

Built using gcc 3.3.5 (propolice).

--
The secs member of a wtap_nstime struct is initialized in the
merge.c:merge_read_packet() to (time_t)LONG_MAX which results in a (64 bit)
integer value of -1.  As a result, no packets are newer (less) than this
initial value and mergecap will *not* attempt to do any merging.

I've appended a gdb snippet that shows the result of the initialization. 
is_earlier() (called later in merge_read_packet()) never finds a packet earlier
than the one initialized to -1.

The following patch appears to fix the problem on amd64 and doesn't seem to
break the i386 version on OpenBSD.

--- merge.c.orig        Fri Feb  6 15:57:22 2009
+++ merge.c     Mon Feb 23 12:14:05 2009
@@ -157,7 +157,7 @@
 {
   int i;
   int ei = -1;
-  struct wtap_nstime tv = {(time_t)LONG_MAX, INT_MAX};
+  struct wtap_nstime tv = { INT_MAX, 0};
   struct wtap_pkthdr *phdr;

   /*


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.