Commit 0e90588fc653d9ef0965c9420e8c39f615393b0d

Stefan Sperling 2022-06-07T17:50:48

in enumeration_request(), use the correct index for tagged commit objects Fixes an error where got-read-pack errors out with "bad object data" during 'got send' because we ended up handing a tag object to the commit object parser.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index ac2b697..07b64ca 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -1355,6 +1355,9 @@ enumeration_request(struct imsg *imsg, struct imsgbuf *ibuf,
 				free(buf);
 				goto done;
 			}
+			idx = got_packidx_get_object_idx(packidx, &tag->id);
+			if (idx == -1)
+				break;
 			err = open_commit(&commit, pack, packidx, idx,
 			    &tag->id, objcache);
 			got_object_tag_close(tag);