From: Junio C Hamano Date: Tue, 13 Dec 2005 00:42:38 +0000 (-0800) Subject: Revert "diff-delta.c: allow delta with empty blob." X-Git-Tag: v0.99.9n^2~21 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=c7a45bd20e4ec141fdc15f36d261a45d51d95693;hp=44db136cad84c003506e231a38935ca6acba4d7d;p=git.git Revert "diff-delta.c: allow delta with empty blob." This reverts 962537a3eb03a118cf27d9d0da365a3216ed1caa commit to play safe. --- diff --git a/delta.h b/delta.h index c6a47635..31d1820f 100644 --- a/delta.h +++ b/delta.h @@ -9,8 +9,8 @@ extern void *patch_delta(void *src_buf, unsigned long src_size, void *delta_buf, unsigned long delta_size, unsigned long *dst_size); -/* the smallest possible delta size is 2 bytes (empty to empty) */ -#define DELTA_SIZE_MIN 2 +/* the smallest possible delta size is 4 bytes */ +#define DELTA_SIZE_MIN 4 /* * This must be called twice on the delta data buffer, first to get the diff --git a/diff-delta.c b/diff-delta.c index cf501389..b2ae7b5e 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -213,7 +213,7 @@ void *diff_delta(void *from_buf, unsigned long from_size, bdrecord_t *brec; bdfile_t bdf; - if (delta_prepare(from_buf, from_size, &bdf)) + if (!from_size || !to_size || delta_prepare(from_buf, from_size, &bdf)) return NULL; outpos = 0;