diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-01-13 17:24:41 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-13 21:53:47 -0800 |
commit | fc150caf67d91b0eeba359d63b4ce707aba8b5ca (patch) | |
tree | 05488f25c7af945aa805116cb7fc166670404eba /Documentation/git-archive.txt | |
parent | retry_bad_packed_offset(): convert to new revindex API (diff) | |
download | tgif-fc150caf67d91b0eeba359d63b4ce707aba8b5ca.tar.xz |
packed_object_info(): convert to new revindex API
Convert another call of 'find_pack_revindex()' to its replacement
'pack_pos_to_offset()'. Likewise:
- Avoid manipulating `struct packed_git`'s `revindex` pointer directly
by removing the pointer-as-array indexing.
- Add an additional guard to check that the offset 'obj_offset()'
points to a real object. This should be the case with well-behaved
callers to 'packed_object_info()', but isn't guarenteed.
Other blocks that fill in various other values from the 'struct
object_info' request handle bad inputs by setting the type to
'OBJ_BAD' and jumping to 'out'. Do the same when given a bad offset
here.
The previous code would have segfaulted when given a bad
'obj_offset' value, since 'find_pack_revindex()' would return
'NULL', and then the line that fills 'oi->disk_sizep' would try to
access 'NULL[1]' with a stride of 16 bytes (the width of 'struct
revindex_entry)'.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-archive.txt')
0 files changed, 0 insertions, 0 deletions