summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-03-24 20:39:00 +0100
committerHelmut Grohne <helmut@subdivi.de>2013-03-24 20:39:00 +0100
commit4e25336922485a918e2f8bf84cd1a82f10c78351 (patch)
tree5cb8db6e177225836d64e7e57fa37b4f6861cd5d
parent5ba224a5aa2c8adb662136e2b8838d1cb0d32f27 (diff)
downloadssdeep-4e25336922485a918e2f8bf84cd1a82f10c78351.tar.gz
do not fail digest computation that often
-rw-r--r--fuzzy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fuzzy.c b/fuzzy.c
index 19ba00b..c82d3c1 100644
--- a/fuzzy.c
+++ b/fuzzy.c
@@ -222,11 +222,13 @@ int fuzzy_digest(const struct fuzzy_state *self, /*@out@*/ char *result) {
/* Initial blocksize guess. */
while((size_t)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self->total_size) {
++bi;
- if(bi >= self->bhend)
+ if(bi >= SSDEEP_BS(NUM_BLOCKHASHES))
/* The input exceeds data types. */
return -1;
}
/* Adapt blocksize guess to actual digest length. */
+ while(bi >= self->bhend)
+ --bi;
while(bi > self->bhstart && self->bh[bi].dlen < SPAMSUM_LENGTH / 2)
--bi;
assert(!(bi > 0 && self->bh[bi].dlen < SPAMSUM_LENGTH / 2));