From: Wayne Davison Date: Sat, 21 Aug 2010 18:26:21 +0000 (-0700) Subject: Avoid infinite loop if the file's length is negative. X-Git-Tag: v3.0.8pre1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10cd07c22555768819cdc3a00f1c51d3d7d777a7;p=thirdparty%2Frsync.git Avoid infinite loop if the file's length is negative. Fixes bug 4664. --- diff --git a/generator.c b/generator.c index 3467cfa8..635fcb97 100644 --- a/generator.c +++ b/generator.c @@ -761,6 +761,12 @@ static void sum_sizes_sqroot(struct sum_struct *sum, int64 len) int s2length; int64 l; + if (len < 0) { + /* The file length overflowed our int64 var, so we can't process this file. */ + sum->count = -1; /* indicate overflow error */ + return; + } + if (block_size) blength = block_size; else if (len <= BLOCK_SIZE * BLOCK_SIZE)