commit-graph, fuzz: add fuzzer for commit-graph
[gitweb.git] / streaming.c
index cce7b17ea7b3c1328fc8969a42be7399f1706141..ac7c7a22f90b7320a235f23db9387fd91ba5b2cd 100644 (file)
@@ -117,7 +117,7 @@ static enum input_source istream_source(const struct object_id *oid,
 
        oi->typep = type;
        oi->sizep = &size;
-       status = oid_object_info_extended(oid, oi, 0);
+       status = oid_object_info_extended(the_repository, oid, oi, 0);
        if (status < 0)
                return stream_error;
 
@@ -408,6 +408,15 @@ static read_method_decl(pack_non_delta)
                        st->z_state = z_done;
                        break;
                }
+
+               /*
+                * Unlike the loose object case, we do not have to worry here
+                * about running out of input bytes and spinning infinitely. If
+                * we get Z_BUF_ERROR due to too few input bytes, then we'll
+                * replenish them in the next use_pack() call when we loop. If
+                * we truly hit the end of the pack (i.e., because it's corrupt
+                * or truncated), then use_pack() catches that and will die().
+                */
                if (status != Z_OK && status != Z_BUF_ERROR) {
                        git_inflate_end(&st->z);
                        st->z_state = z_error;