diff options
author | René Scharfe <l.s.r@web.de> | 2017-07-16 14:17:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-07-17 14:56:16 -0700 |
commit | 268ba20110f9e6aca3a7bf8b256f7a8fbfd2dab9 (patch) | |
tree | 23c369ba892f84cbdffdbc7d09e12fa20dc82e34 /contrib | |
parent | Git 2.12.3 (diff) | |
download | tgif-268ba20110f9e6aca3a7bf8b256f7a8fbfd2dab9.tar.xz |
dir: support platforms that require aligned reads
The untracked cache is stored on disk by concatenating its memory
structures without any padding. Consequently some of the structs are
not aligned at a particular boundary when the whole extension is read
back in one go. That's only OK on platforms without strict alignment
requirements, or for byte-aligned data like strings or hash values.
Decode struct ondisk_untracked_cache carefully from the extension
blob by using explicit pointer arithmetic with offsets, avoiding
alignment issues. Use char pointers for passing stat_data objects to
stat_data_from_disk(), and use memcpy(3) in that function to get the
contents into a properly aligned struct, then perform the byte-order
adjustment in place there.
Found with Clang's UBSan.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions