mirror of
https://github.com/git/git.git
synced 2026-01-09 01:34:00 +00:00
Merge branch 'jk/asan-bonanza'
Various issues detected by Asan have been corrected. * jk/asan-bonanza: t: enable ASan's strict_string_checks option fsck: avoid parse_timestamp() on buffer that isn't NUL-terminated fsck: remove redundant date timestamp check fsck: avoid strcspn() in fsck_ident() fsck: assert newline presence in fsck_ident() cache-tree: avoid strtol() on non-string buffer Makefile: turn on NO_MMAP when building with ASan pack-bitmap: handle name-hash lookups in incremental bitmaps compat/mmap: mark unused argument in git_munmap()
This commit is contained in:
@@ -213,6 +213,28 @@ static uint32_t bitmap_num_objects(struct bitmap_index *index)
|
||||
return index->pack->num_objects;
|
||||
}
|
||||
|
||||
static uint32_t bitmap_name_hash(struct bitmap_index *index, uint32_t pos)
|
||||
{
|
||||
if (bitmap_is_midx(index)) {
|
||||
while (index && pos < index->midx->num_objects_in_base) {
|
||||
ASSERT(bitmap_is_midx(index));
|
||||
index = index->base;
|
||||
}
|
||||
|
||||
if (!index)
|
||||
BUG("NULL base bitmap for object position: %"PRIu32, pos);
|
||||
|
||||
pos -= index->midx->num_objects_in_base;
|
||||
if (pos >= index->midx->num_objects)
|
||||
BUG("out-of-bounds midx bitmap object at %"PRIu32, pos);
|
||||
}
|
||||
|
||||
if (!index->hashes)
|
||||
return 0;
|
||||
|
||||
return get_be32(index->hashes + pos);
|
||||
}
|
||||
|
||||
static struct repository *bitmap_repo(struct bitmap_index *bitmap_git)
|
||||
{
|
||||
if (bitmap_is_midx(bitmap_git))
|
||||
@@ -1724,8 +1746,7 @@ static void show_objects_for_type(
|
||||
pack = bitmap_git->pack;
|
||||
}
|
||||
|
||||
if (bitmap_git->hashes)
|
||||
hash = get_be32(bitmap_git->hashes + index_pos);
|
||||
hash = bitmap_name_hash(bitmap_git, index_pos);
|
||||
|
||||
show_reach(&oid, object_type, 0, hash, pack, ofs, payload);
|
||||
}
|
||||
@@ -3124,8 +3145,8 @@ uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git,
|
||||
|
||||
if (oe) {
|
||||
reposition[i] = oe_in_pack_pos(mapping, oe) + 1;
|
||||
if (bitmap_git->hashes && !oe->hash)
|
||||
oe->hash = get_be32(bitmap_git->hashes + index_pos);
|
||||
if (!oe->hash)
|
||||
oe->hash = bitmap_name_hash(bitmap_git, index_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user