From 813d5a25e307bf86169ac6f30b120c02ff116667 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 22 Apr 2011 11:31:29 -0700 Subject: [PATCH] Fix a potential crash when trying to find a better block match. --- match.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/match.c b/match.c index 9da18a76..f327fd37 100644 --- a/match.c +++ b/match.c @@ -239,8 +239,9 @@ static void hash_search(int f,struct sum_struct *s, aligned_offset += s->blength; aligned_i++; } - if (offset == aligned_offset - || (sum == 0 && l == s->blength && aligned_offset + l <= len)) { + if ((offset == aligned_offset + || (sum == 0 && l == s->blength && aligned_offset + l <= len)) + && aligned_i < s->count) { if (i != aligned_i) { if (sum != s->sums[aligned_i].sum1 || l != s->sums[aligned_i].len -- 2.34.1