Merge branch 'ah/uninitialized-reads-fix'

Make the codebase MSAN clean.

* ah/uninitialized-reads-fix:
  builtin/checkout--worker: zero-initialise struct to avoid MSAN complaints
  split-index: use oideq instead of memcmp to compare object_id's
  bulk-checkin: make buffer reuse more obvious and safer
This commit is contained in:
Junio C Hamano 2021-07-08 13:14:58 -07:00
Родитель 7e24201365 4dbc55e87d
Коммит 1d38852b11
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -53,7 +53,7 @@ static void packet_to_pc_item(const char *buffer, int len,
static void report_result(struct parallel_checkout_item *pc_item)
{
struct pc_item_result res;
struct pc_item_result res = { 0 };
size_t size;
res.id = pc_item->id;

Просмотреть файл

@ -100,6 +100,7 @@ static int stream_to_pack(struct bulk_checkin_state *state,
const char *path, unsigned flags)
{
git_zstream s;
unsigned char ibuf[16384];
unsigned char obuf[16384];
unsigned hdrlen;
int status = Z_OK;
@ -113,8 +114,6 @@ static int stream_to_pack(struct bulk_checkin_state *state,
s.avail_out = sizeof(obuf) - hdrlen;
while (status != Z_STREAM_END) {
unsigned char ibuf[16384];
if (size && !s.avail_in) {
ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf);
ssize_t read_result = read_in_full(fd, ibuf, rsize);

Просмотреть файл

@ -207,7 +207,8 @@ static int compare_ce_content(struct cache_entry *a, struct cache_entry *b)
b->ce_flags &= ondisk_flags;
ret = memcmp(&a->ce_stat_data, &b->ce_stat_data,
offsetof(struct cache_entry, name) -
offsetof(struct cache_entry, ce_stat_data));
offsetof(struct cache_entry, oid)) ||
!oideq(&a->oid, &b->oid);
a->ce_flags = ce_flags;
b->ce_flags = base_flags;