[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:21:16 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 7ba110bdb3b99251351114b5d1fb97e6ba646889
Author: Török Edvin <edwin at clamav.net>
Date: Mon Feb 22 15:44:23 2010 +0200
Don't use prefiltering for BM offset mode.
BM offset mode keeps tracks of offsets itself, and gets confused if chunks of
input are skipped.
diff --git a/libclamav/matcher.c b/libclamav/matcher.c
index bc118ce..bb5ec93 100644
--- a/libclamav/matcher.c
+++ b/libclamav/matcher.c
@@ -87,6 +87,9 @@ static inline int matcher_run(const struct cli_matcher *root,
int ret;
int32_t pos = 0;
struct filter_match_info info;
+ uint32_t orig_length, orig_offset;
+ const unsigned char* orig_buffer;
+
if (root->filter) {
if(filter_search_ext(root->filter, buffer, length, &info) == -1) {
/* for safety always scan last maxpatlen bytes */
@@ -103,13 +106,28 @@ static inline int matcher_run(const struct cli_matcher *root,
} else {
PERF_LOG_FILTER(0, length, root->type);
}
+
+ orig_length = length;
+ orig_buffer = buffer;
+ orig_offset = offset;
length -= pos;
buffer += pos;
offset += pos;
- if (root->ac_only || PERF_LOG_TRIES(0,1, length) || (ret = cli_bm_scanbuff(buffer, length, virname, NULL, root, offset, map, offdata)) != CL_VIRUS) {
- PERF_LOG_TRIES(acmode, 0, length);
- ret = cli_ac_scanbuff(buffer, length, virname, NULL, NULL, root, mdata, offset, ftype, ftoffset, acmode, NULL);
+ if (!root->ac_only) {
+ PERF_LOG_TRIES(0, 1, length);
+ if (root->bm_offmode) {
+ /* Don't use prefiltering for BM offset mode, since BM keeps tracks
+ * of offsets itself, and doesn't work if we skip chunks of input
+ * data */
+ ret = cli_bm_scanbuff(orig_buffer, orig_length, virname, NULL, root, orig_offset, map, offdata);
+ } else {
+ ret = cli_bm_scanbuff(buffer, length, virname, NULL, root, offset, map, offdata);
+ }
+ if (ret == CL_VIRUS)
+ return ret;
}
+ PERF_LOG_TRIES(acmode, 0, length);
+ ret = cli_ac_scanbuff(buffer, length, virname, NULL, NULL, root, mdata, offset, ftype, ftoffset, acmode, NULL);
return ret;
}
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list