[bug] Reliably Reproducible Bad Packing of Objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

when run on a 32 bit system (Linux system, don't know about other
systems),

mkdir test && cd test && git init && touch someFile && git add someFile
&& git commit -m "Initial commit." && dd if=/dev/urandom
of=bigBinaryFile bs=1MB count=4294 && git add bigBinaryFile && git
commit -m "Introduced big biary file."

reliably produces this error message: "error: bad packed object CRC
for"

Since git counts sizes in byte and uses ints for it, it can't handle
files bigger than (2^32 - 1) byte. That's 4'294.967296 MB. If you give
git a file bigger than it can handle, it usually just says "fatal:
Cannot handle files this big" without corrupting the repository. Btw.:
It'd be nice if the error message stated that this only occurs on 32
bit system and only with files 4 GiB in size or bigger.

To provoke the bug, the commands above creates a file which cannot be
compressed slightly less than (2^32 - 1) byte big, probably resulting
in a commit more than (2^32 - 1) byte big.

I was able to reproduce the bug on a Raspberry Pi Model 3 (ARMv7 CPU)
and a virtual machine running Ubuntu 16.04 32 bit (which was
specifically set up to test this, so it was a clean installation) on a
host running Ubuntu 16.04 64 bit on an ARM 64 bit x86 CPU (i7-4720HQ).

Output on raspi: https://gist.github.com/m1cm1c/d874f03be5b12cbd8b86ced
79fa456d1
Output on virt. machine: https://gist.github.com/m1cm1c/d0dd47828386bb0
f1e001b9f750416e0

Note that on the raspi I concatenated `git gc` to the end to show that
the object exists but is corrupt but you can already see that something
went wrong before `git gc` is executed.

If you look at the output on the virtual machine, however, you will not
see that something wrong until you read the part where I typed in `git
gc` which I find particularly worrying.

When checking whether you get the same result, please make sure to use
git 1.7.6 or newer. If you use an older version of git (older versions
are still being distributed, for example for Ubuntu 14.04), git will
try to memory-map a too big file resulting in a different error.

-- 
With kind regards
Christoph Michelbach

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]