[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
Török Edvin
edwin at clamav.net
Sun Apr 4 01:14:22 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 422faf754c08f43205676e1d63f5c9f838c228d4
Author: Török Edvin <edwin at clamav.net>
Date: Mon Jan 11 12:43:21 2010 +0200
Fix infinite loop in lookup.
This happens due to deleted keys filling the hash,
workaround this issue for now, if this is a performance hog
we'll need to periodically clean up the deleted slots by rehashing
elements.
diff --git a/libclamav/cache.c b/libclamav/cache.c
index 618d49f..36d40ad 100644
--- a/libclamav/cache.c
+++ b/libclamav/cache.c
@@ -35,8 +35,8 @@
static mpool_t *mempool = NULL;
-//#define USE_LRUHASHCACHE
-#define USE_SPLAY
+#define USE_LRUHASHCACHE
+//#define USE_SPLAY
#ifdef USE_LRUHASHCACHE
struct cache_key {
@@ -92,6 +92,7 @@ static void cacheset_lru_remove(struct cache_set *map, size_t howmany)
* we remove due to LRU! */
if (old == map->lru_tail)
map->lru_tail = 0;
+ map->elements--;
}
}
@@ -100,7 +101,7 @@ int cacheset_lookup_internal(struct cache_set *map, unsigned char *md5, size_t s
uint32_t idx = cli_readint32(md5+8) & (map->capacity -1);
uint32_t tries = 0;
struct cache_key *k = &map->data[idx];
- while (k->size != CACHE_KEY_EMPTY) {
+ while (k->size != CACHE_KEY_EMPTY && tries < map->capacity) {
if (k->size == size &&
!memcmp(k->digest, md5, 16)) {
/* found key */
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list