From da41c942b307e0beab1fc5800a42b0c495f54ff6 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Mon, 26 Jun 2017 16:16:12 +0100 Subject: pack-bitmap: don't perform unaligned memory access The preceding bitmap entries have a 1-byte XOR-offset and 1-byte flags, so their size is not a multiple of 4. Thus the name-hash cache is only guaranteed to be 2-byte aligned and so we must use get_be32 rather than indexing the array directly. Signed-off-by: James Clarke Signed-off-by: Junio C Hamano --- pack-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pack-bitmap.c') diff --git a/pack-bitmap.c b/pack-bitmap.c index b949e5171..09de9ba31 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -627,7 +627,7 @@ static void show_objects_for_type( sha1 = nth_packed_object_sha1(bitmap_git.pack, entry->nr); if (bitmap_git.hashes) - hash = ntohl(bitmap_git.hashes[entry->nr]); + hash = get_be32(bitmap_git.hashes + entry->nr); show_reach(sha1, object_type, 0, hash, bitmap_git.pack, entry->offset); } -- cgit v1.2.1