Skip to content

Commit 5305a55

Browse files
telezhnayagitster
authored andcommitted
ref-filter: add check for negative file size
If we have negative file size, we are doing something wrong. Signed-off-by: Olga Telezhnaia <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1867ce6 commit 5305a55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ref-filter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,8 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj
14871487
OBJECT_INFO_LOOKUP_REPLACE))
14881488
return strbuf_addf_ret(err, -1, _("missing object %s for %s"),
14891489
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.");
14901492

14911493
if (oi->info.contentp) {
14921494
*obj = parse_object_buffer(the_repository, &oi->oid, oi->type, oi->size, oi->content, &eaten);

0 commit comments

Comments
 (0)