ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 7624] New: epan/dissectors/packet-per.c dissect_per_constr

Date: Mon, 13 Aug 2012 04:11:28 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7624

           Summary: epan/dissectors/packet-per.c
                    dissect_per_constrained_integer_64b fails for 64 bits.
           Product: Wireshark
           Version: SVN
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Low
         Component: Dissection engine (libwireshark)
        AssignedTo: bugzilla-admin@xxxxxxxxxxxxx
        ReportedBy: jfcmdejongh@xxxxxxxxx


Created attachment 8948
  --> https://bugs.wireshark.org/bugzilla/attachment.cgi?id=8948
Patch file.

Build Information:
Compiled (32-bit) with GTK+ 2.24.10, with Cairo 1.10.2, with Pango 1.30.0, with
GLib 2.32.3, with libpcap, with libz 1.2.5, with POSIX capabilities (Linux),
without SMI, without c-ares, without ADNS, without Lua, without Python, with
GnuTLS 2.12.17, with Gcrypt 1.5.0, with MIT Kerberos, without GeoIP, without
PortAudio, with AirPcap.

Running on Linux 3.4.4-3.fc17.i686, with locale en_US.UTF-8, with libpcap
version 1.2.1, with libz 1.2.5, GnuTLS 2.12.17, Gcrypt 1.5.0, without AirPcap.

Built using gcc 4.7.0 20120507 (Red Hat 4.7.0-5).

--
Applicable to 1.8.1 and svn (20120813):

The following piece of code in epan/dissectors/packet-per.c, function
dissect_per_constrained_integer_64b fails with UPER, because the number of bits
required is still calculated with 32-bit masks:

                guint32 mask,mask2;
                /* We only handle 32 bit integers */
                mask  = 0x80000000;
                mask2 = 0x7fffffff;
                i = 32;
                while ((range & mask)== 0){
                        i = i - 1;
                        mask = mask>>1;
                        mask2 = mask2>>1;
                }
                if ((range & mask2) == 0)
                        i = i-1;

Suggestion for fix (patch attached):

                guint64 mask,mask2;
                /* We only handle 64 bit integers */
                mask  = G_GINT64_CONSTANT(0x8000000000000000);
                mask2 = G_GINT64_CONSTANT(0x7fffffffffffffff);
                i = 64;
                while ((range & mask)== 0){
                        i = i - 1;
                        mask = mask>>1;
                        mask2 = mask2>>1;
                }
                if ((range & mask2) == 0)
                        i = i-1;

- JdJ

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