Wireshark mailing list archives

Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC)


From: Guy Harris <guy () alum mit edu>
Date: Mon, 25 Nov 2013 10:40:36 -0800


On Nov 24, 2013, at 5:37 PM, Bálint Réczey <balint () balintreczey hu> wrote:

I tried to trigger a crash using GCC and -ftrapv without success while
the clang-compiled binary crashed as expected:

Reproduced with clang on (x86-64) OS X.

The problem is in

        PRIVATE int strhash(const char *x)
        {
          int h = 0;
          while( *x) h = h*13 + *(x++);
          return h;
        }

In practice, the result of the hash function is taken modulo the hash table size, and that's always done with &, so, in 
practice, it's safe if it overflows.

Perhaps it should do the calculation with unsigned integers and return an unsigned integer, however.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: