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
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index 289a9b8..fb9fd13 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -53,7 +53,7 @@
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;
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 127312a..b023d99 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -100,6 +100,7 @@
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 @@
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);
diff --git a/split-index.c b/split-index.c
index 4d6e52d..8e52e89 100644
--- a/split-index.c
+++ b/split-index.c
@@ -207,7 +207,8 @@
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;