diff options
author | Jeff King <peff@peff.net> | 2013-07-10 07:50:26 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-12 09:18:42 -0700 |
commit | 012b32bb46459f96509669c2f5be0a93a95a2b43 (patch) | |
tree | ad8e045fe8db9228b0752cccc8bfe365ed3de5f5 /t/t1512-rev-parse-disambiguation.sh | |
parent | cat-file: split --batch input lines on whitespace (diff) | |
download | tgif-012b32bb46459f96509669c2f5be0a93a95a2b43.tar.xz |
pack-revindex: use unsigned to store number of objects
A packfile may have up to 2^32-1 objects in it, so the
"right" data type to use is uint32_t. We currently use a
signed int, which means that we may behave incorrectly for
packfiles with more than 2^31-1 objects on 32-bit systems.
Nobody has noticed because having 2^31 objects is pretty
insane. The linux.git repo has on the order of 2^22 objects,
which is hundreds of times smaller than necessary to trigger
the bug.
Let's bump this up to an "unsigned". On 32-bit systems, this
gives us the correct data-type, and on 64-bit systems, it is
probably more efficient to use the native "unsigned" than a
true uint32_t.
While we're at it, we can fix the binary search not to
overflow in such a case if our unsigned is 32 bits.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1512-rev-parse-disambiguation.sh')
0 files changed, 0 insertions, 0 deletions