commit 5a17689a92bb716ecff551f2a18eab30e762ed6b from: Stefan Sperling date: Thu Sep 24 00:28:58 2020 UTC fix matching the object ID of the first object in a pack index An object ID which appears first in a pack index was wrongly ignored by got_packidx_match_id_str_prefix(). The result was a spurious "object not found" error when this object ID was passed on the command line. Reported by jrick on freenode who was lucky enough to this edge case! commit - 0a22ca1a5a1261bb7e230db211a205b68e1c3044 commit + 5a17689a92bb716ecff551f2a18eab30e762ed6b blob - ad61697895ee0d4066a8f7b1036fc1e0ac5fd005 blob + 71b5e073f220e543460f8542ee644483ce51b73d --- lib/pack.c +++ lib/pack.c @@ -468,7 +468,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_q char hex[3]; size_t prefix_len = strlen(id_str_prefix); struct got_packidx_object_id *oid; - int i; + uint32_t i; SIMPLEQ_INIT(matched_ids); @@ -482,9 +482,6 @@ got_packidx_match_id_str_prefix(struct got_object_id_q return got_error_path(id_str_prefix, GOT_ERR_BAD_OBJ_ID_STR); i = be32toh(packidx->hdr.fanout_table[id0 - 1]); - if (i == 0) - return NULL; - oid = &packidx->hdr.sorted_ids[i]; while (i < totobj && oid->sha1[0] == id0) { char id_str[SHA1_DIGEST_STRING_LENGTH];