]> git.ipfire.org Git - thirdparty/git.git/commit
parse_pack_header_option(): avoid unaligned memory writes
authorJeff King <peff@peff.net>
Sun, 19 Jan 2025 13:23:44 +0000 (08:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Jan 2025 16:42:55 +0000 (08:42 -0800)
commit4f02f4d68d8eefe728008974640839ef6e1b2182
tree5b6b89d7336b98bc7e9466258dab38b3da71c03d
parent798e0f451661f81f4568dce4033cf1c9076f224f
parse_pack_header_option(): avoid unaligned memory writes

In order to recreate a pack header in our in-memory buffer, we cast the
buffer to a "struct pack_header" and assign the individual fields. This
is reported to cause SIGBUS on sparc64 due to alignment issues.

We can work around this by using put_be32() which will write individual
bytes into the buffer.

Reported-by: Koakuma <koachan@protonmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
packfile.c