From dc60cd09c49f52d2eba6c169f973f757695e4f5a Mon Sep 17 00:00:00 2001 From: Vinicius Silva Nogueira Date: Thu, 13 Jan 2022 13:35:06 -0300 Subject: fix ahocorasick on big-endian machines (#1401) --- src/lib/third_party/src/ahocorasick.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/third_party/src/ahocorasick.c b/src/lib/third_party/src/ahocorasick.c index ba526056f..39b08443b 100644 --- a/src/lib/third_party/src/ahocorasick.c +++ b/src/lib/third_party/src/ahocorasick.c @@ -849,7 +849,11 @@ xmemchr(char *s, char i,int n) mask = c * DUPC; while (n >= LBLOCKSIZE) { - unsigned long int nc = DETECTNULL((*(unsigned long int *)s) ^ mask); +#if __SIZEOF_LONG__ == 4 + unsigned long int nc = DETECTNULL(le32toh(*(unsigned long int *)s) ^ mask); +#else + unsigned long int nc = DETECTNULL(le64toh(*(unsigned long int *)s) ^ mask); +#endif if(nc) return s + (bsf(nc) >> 3); s += LBLOCKSIZE; -- cgit v1.2.3