aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2010-08-21 11:26:21 -0700
committerWayne Davison <wayned@samba.org>2010-09-06 08:05:26 -0700
commit10cd07c22555768819cdc3a00f1c51d3d7d777a7 (patch)
tree1eb12785d0b626b5919d1a2591a1062b46f7cefb
parent62e9eb7bc2c593d40951f5099a36442537732a5c (diff)
downloadandroid_external_rsync-10cd07c22555768819cdc3a00f1c51d3d7d777a7.tar.gz
android_external_rsync-10cd07c22555768819cdc3a00f1c51d3d7d777a7.tar.bz2
android_external_rsync-10cd07c22555768819cdc3a00f1c51d3d7d777a7.zip
Avoid infinite loop if the file's length is negative.
Fixes bug 4664.
-rw-r--r--generator.c6
1 files changed, 6 insertions, 0 deletions
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)