"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: MurmurHash2 unaligned access
To:
gameoftrees@openbsd.org
Date:
Thu, 14 Oct 2021 19:02:37 +0200

Download raw body.

Thread
Stefan Sperling:

> Just out of curiousity, can you produce a short
> program that calls murmurhash2 and triggers an alignment fault on sparc64,
> octeon, or similar platforms?

I don't have a strict alignment arch at hand, but this should do
it:

#include <sys/types.h>
#include <murmurhash2.h>
#include <stdio.h>

#define SIZE 10

int main(void)
{
	char a[SIZE+4];
	int i;

	for (i = 0; i < 4; i++) {
		printf("%d\n", i);
		fflush(stdout);
		murmurhash2(a+i, SIZE, 0);
	}

	return 0;
}

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de