summaryrefslogtreecommitdiff
path: root/csum-file.h
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2010-10-18 14:39:17 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-10-29 14:13:33 -0700
commit24305cd7009d682ba4115103c95844446a2bb305 (patch)
treedee9960c98dde707d545b022dcb8c5d9d4b4ba50 /csum-file.h
parentGit 1.7.3 (diff)
downloadtgif-24305cd7009d682ba4115103c95844446a2bb305.tar.xz
apply: don't segfault on binary files with missing data
Usually when applying a binary diff generated without --binary, it will be rejected early, as we don't even have the full sha1 of the pre- and post-images. However, if the diff is generated with --full-index (but not --binary), then we will actually try to apply it. If we have the postimage blob, then we can take a shortcut and never even look at the binary diff at all (e.g., this can happen when rebasing changes within a repository). If we don't have the postimage blob, though, we try to look at the actual fragments, of which there are none, and get a segfault. This patch checks explicitly for that case and complains to the user instead of segfaulting. We need to keep the check at a low level so that the "shortcut" case above continues to work. We also add a test that demonstrates the segfault. While we're at it, let's also explicitly test the shortcut case. Reported-by: Rafaël Carré <rafael.carre@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'csum-file.h')
0 files changed, 0 insertions, 0 deletions