1
0
mirror of https://github.com/git/git.git synced 2025-03-14 16:58:12 +00:00

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>
This commit is contained in:
Olga Telezhnaya 2018-12-24 13:24:30 +00:00 committed by Junio C Hamano
parent 1867ce6cbe
commit 5305a55348

View File

@ -1487,6 +1487,8 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj
OBJECT_INFO_LOOKUP_REPLACE))
return strbuf_addf_ret(err, -1, _("missing object %s for %s"),
oid_to_hex(&oi->oid), ref->refname);
if (oi->info.disk_sizep && oi->disk_size < 0)
BUG("Object size is less than zero.");
if (oi->info.contentp) {
*obj = parse_object_buffer(the_repository, &oi->oid, oi->type, oi->size, oi->content, &eaten);