diff mbox series

[v3,2/6] ref-filter: add check for negative file size

Message ID 0102016836761be3-b35028e3-800e-4f54-b608-55cebf6feaa9-000000@eu-west-1.amazonses.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/6] ref-filter: add objectsize:disk option | expand

Commit Message

Olga Telezhnaya Jan. 10, 2019, 6:32 a.m. UTC
If we have negative file size, we are doing something wrong.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
---
 ref-filter.c | 2 ++
 1 file changed, 2 insertions(+)


--
https://github.com/git/git/pull/552
diff mbox series

Patch

diff --git a/ref-filter.c b/ref-filter.c
index ecef4b47c751c..57f3789d1040d 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1491,6 +1491,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);