ref-filter: add check for negative file size
If we have negative file size, we are doing something wrong. Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olga Telezhnaya committed
Dec 24, 2018 at 13:24 UTC
5305a55348c102475c1bcb56e8fcbabe37178112
1 file changed
+2
ref-filter.c
+2
@@ -1487,6 +1487,8 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj
1487
OBJECT_INFO_LOOKUP_REPLACE))
1488
return strbuf_addf_ret(err, -1, _("missing object %s for %s"),
1489
oid_to_hex(&oi->oid), ref->refname);
1490
+ if (oi->info.disk_sizep && oi->disk_size < 0)
1491
+ BUG("Object size is less than zero.");
1492
1493
if (oi->info.contentp) {
1494
*obj = parse_object_buffer(the_repository, &oi->oid, oi->type, oi->size, oi->content, &eaten);