[Clamav-devel] About BM_MIN_LENGTH and BM_BLOCK_SIZE in mate…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Leo Jiang
Date:  
To: clamav-devel
Subject: [Clamav-devel] About BM_MIN_LENGTH and BM_BLOCK_SIZE in mater-bm.c
Hi,

Now in codes both of BM_MIN_LENGTH and BM_BLOCK_SIZE is zero. (In file "matcher-bm.c")

So in function "cli_bm_addpatt"

These codes:

for (i = BM_MIN_LENGTH - BM_BLOCK_SIZE; i >= 0; i--)
{
    idx = HASH(pt[i], pt[i + 1], pt[i + 2]);
    root->bm_shift[idx] = MIN(root->bm_shift[idx], BM_MIN_LENGTH - BM_BLOCK_SIZE - i);
}

i = BM_MIN_LENGTH - BM_BLOCK_SIZE;
idx = HASH(pt[i], pt[i + 1], pt[i + 2]);

equals:

idx = HASH(pt[0], pt[1], pt[2]);
root->bm_shift[idx] = 0;

In my option one BM virus signature was load will using more instructions.
More big the database is, more slow while loading it.

And now bm_shift[] only have 2 value, one is 1 and another is 0.
But in codes it using a int32_t type.
I think it should using a unsigned char instead of int32_t.
This will reduce a lot of memory, and it's very useful in a embedded system.


Best regards,
Leo Jiang <>


_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net