Commits

Anonymous committed c6a4e3f Merge

Merge branch 'mm/empty-loose-error-message' into maint

* mm/empty-loose-error-message:
fsck: give accurate error message on empty loose object files

Comments (0)

Files changed (1)

 
 		if (!fstat(fd, &st)) {
 			*size = xsize_t(st.st_size);
+			if (!*size) {
+				/* mmap() is forbidden on empty files */
+				error("object file %s is empty", sha1_file_name(sha1));
+				return NULL;
+			}
 			map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
 		}
 		close(fd);