[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:15:58 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit acba3cf51b5bf0f86a02c116cb320f63ab2b7008
Author: Török Edvin <edwin at clamav.net>
Date:   Wed Jan 20 18:12:10 2010 +0200

    Prevent check from hanging/crashing when there is a version mismatch.
    
    Show an error on version mismatch, 0.9.8 library with header
    from 0.9.6 causes hangs/crashes.

diff --git a/unit_tests/check_clamav.c b/unit_tests/check_clamav.c
index 52d9f3c..b459a1e 100644
--- a/unit_tests/check_clamav.c
+++ b/unit_tests/check_clamav.c
@@ -516,12 +516,37 @@ void dconf_teardown(void)
 #endif
 }
 
+static void check_version_compatible()
+{
+    /* check 0.9.8 is not ABI compatible with 0.9.6,
+     * if by accident you compile with check 0.9.6 header
+     * and link with 0.9.8 then check will hang/crash. */
+    if ((check_major_version != CHECK_MAJOR_VERSION) ||
+	(check_minor_version != CHECK_MINOR_VERSION) ||
+	(check_micro_version != CHECK_MICRO_VERSION)) {
+	fprintf(stderr, "ERROR: check version mismatch!\n"
+		"\tVersion from header: %u.%u.%u\n"
+		"\tVersion from library: %u.%u.%u\n"
+		"\tMake sure check.h and -lcheck are same version!\n",
+		CHECK_MAJOR_VERSION,
+		CHECK_MINOR_VERSION,
+		CHECK_MICRO_VERSION,
+		check_major_version,
+		check_minor_version,
+		check_micro_version);
+	exit(EXIT_FAILURE);
+    }
+}
 
 int main(void)
 {
     int nf;
-    Suite *s = test_cl_suite();
-    SRunner *sr = srunner_create(s);
+    Suite *s;
+    SRunner *sr;
+
+    check_version_compatible();
+    s = test_cl_suite();
+    sr = srunner_create(s);
 #ifdef CHECK_HAVE_LOOPS
     srunner_add_suite(sr, test_cli_suite());
 #else

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list