diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-03-24 20:39:00 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-03-24 20:39:00 +0100 |
commit | 4e25336922485a918e2f8bf84cd1a82f10c78351 (patch) | |
tree | 5cb8db6e177225836d64e7e57fa37b4f6861cd5d | |
parent | 5ba224a5aa2c8adb662136e2b8838d1cb0d32f27 (diff) | |
download | ssdeep-4e25336922485a918e2f8bf84cd1a82f10c78351.tar.gz |
do not fail digest computation that often
-rw-r--r-- | fuzzy.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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)); |