Browse code

Fix SIGBUS on PA-RISC (big-endian) architectures (bb #3894).

Török Edvin authored on 2011/11/18 22:48:38
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Nov 18 15:48:59 EET 2011 (edwin)
2
+-----------------------------------
3
+ * libclamav/matcher-hash.c: Fix SIGBUS on PA-RISC (big-endian) architectures (bb #3894).
4
+
1 5
 Mon Oct 17 18:04:30 CEST 2011 (tk)
2 6
 ----------------------------------
3 7
  * V 0.97.3
... ...
@@ -127,10 +127,14 @@ static const unsigned int hashlen[] = {
127 127
 
128 128
 
129 129
 static inline int hm_cmp(const uint8_t *itm, const uint8_t *ref, unsigned int keylen) {
130
+#if WORDS_BIGENDIAN == 0
130 131
     uint32_t i = *(uint32_t *)itm, r = *(uint32_t *)ref;
131 132
     if(i!=r)
132 133
 	return (i<r) * 2 -1;
133 134
     return memcmp(&itm[4], &ref[4], keylen - 4);
135
+#else
136
+    return memcmp(itm, ref, keylen);
137
+#endif
134 138
 }
135 139
 
136 140
 static void hm_sort(struct cli_sz_hash *szh, size_t l, size_t r, unsigned int keylen) {