shithub: mc

Download patch

ref: 6ed1ebe0ee2e45b4b9079bf4ed0df24311ae4e8d
parent: 01243d18cc0d8795a9887bc3565d5f48ce3c9430
author: Ori Bernstein <[email protected]>
date: Thu Dec 18 09:57:24 EST 2014

Overflowing an signed value is undefined. Use uintptr_t.

--- a/parse/htab.c
+++ b/parse/htab.c
@@ -262,14 +262,14 @@
 
 ulong ptrhash(void *key)
 {
-    return inthash((intptr_t)key);
+    return inthash((uintptr_t)key);
 }
 
 ulong inthash(uint64_t key)
 {
-    intptr_t h;
+    uintptr_t h;
 
-    h = (intptr_t) key;
+    h = (uintptr_t) key;
     h *= 357913941;
     h ^= h << 24;
     h += ~357913941;