Files
git/builtin
Nguyễn Thái Ngọc Duy af92a645d3 pack-objects: do not truncate result in-pack object size on 32-bit systems
A typical diff will not show what's going on and you need to see full
functions. The core code is like this, at the end of of write_one()

	e->idx.offset = *offset;
	size = write_object(f, e, *offset);
	if (!size) {
		e->idx.offset = recursing;
		return WRITE_ONE_BREAK;
	}
	written_list[nr_written++] = &e->idx;

	/* make sure off_t is sufficiently large not to wrap */
	if (signed_add_overflows(*offset, size))
		die("pack too large for current definition of off_t");
	*offset += size;

Here we can see that the in-pack object size is returned by
write_object (or indirectly by write_reuse_object). And it's used to
calculate object offsets, which end up in the pack index file,
generated at the end.

If "size" overflows (on 32-bit sytems, unsigned long is 32-bit while
off_t can be 64-bit), we got wrong offsets and produce incorrect .idx
file, which may make it look like the .pack file is corrupted.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:15:17 -07:00
..
2016-03-10 11:13:41 -08:00
2016-02-26 13:37:16 -08:00
2015-11-20 08:02:05 -05:00
2016-02-26 13:37:16 -08:00
2015-11-20 08:02:05 -05:00
2016-02-10 14:20:08 -08:00
2015-10-21 15:59:34 -07:00
2016-02-26 13:37:16 -08:00
2016-02-26 13:37:25 -08:00
2015-10-05 13:20:08 -07:00
2015-11-20 08:02:05 -05:00
2016-01-28 16:10:14 -08:00
2015-11-20 08:02:05 -05:00
2016-02-26 13:37:16 -08:00