Wireshark mailing list archives
Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC)
From: Bálint Réczey <balint () balintreczey hu>
Date: Mon, 25 Nov 2013 21:00:50 +0100
2013/11/25 Guy Harris <guy () alum mit edu>:
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.
Yes, signed int overflow yields undefined behaviour, but the result of unsigned overflow is defined thus the code above is invalid C. At least we (you) found a real problem by temporarily enabling the broken -ftrapv. :-) Cheers, Balint ___________________________________________________________________________ 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:
- Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 24)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 24)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 24)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Bálint Réczey (Nov 24)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 25)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 25)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 25)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Bálint Réczey (Nov 25)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 25)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Bálint Réczey (Nov 28)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 24)
- Re: Lemon crashing on Solaris? (was Re: [Wireshark-commits] buildbot failure in Wireshark (development) on Solaris-10-SPARC) Guy Harris (Nov 24)