Commit d60c49c (read-cache.c: allow unaligned mapping of the
index file, 2012-04-03) introduced helpers to access
unaligned data. However, we already have get_be32, which has
a few advantages:
1. It's already written, so we avoid duplication.
2. It's probably faster, since it does the endian
Jeff King wrote:
This _might_ still suffer from the issue fixed in 5f6a112 (block-sha1:
avoid pointer conversion that violates alignment constraints,
2012-07-22), as we are taking the pointer of a uint32 in a struct.
No conversion, so no issue there.
Line 1484 looks more problematic:
On Thu, Jan 23, 2014 at 03:34:16PM -0800, Jonathan Nieder wrote:
Line 1484 looks more problematic:
disk_ce = (struct ondisk_cache_entry *)((char *)mmap +
src_offset);
In v4 indexes, src_offset doesn't have any particular alignment so
this conversion has undefined behavior.
3 matches
Mail list logo