fix unit tests

This commit is contained in:
Sérgio M. Basto 2018-01-11 20:52:57 +00:00
parent 8c0e645ad0
commit 0250ae4d05
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,44 @@
From 60671e3deb1df6c626e5c7e13752c2eec1649f98 Mon Sep 17 00:00:00 2001
From: Steven Morgan <stevmorg@cisco.com>
Date: Wed, 8 Mar 2017 08:58:28 -0500
Subject: [PATCH] bb11798 - fix unit tests.
---
libclamav/wwunpack.c | 9 +++------
unit_tests/check_jsnorm.c | 2 +-
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/libclamav/wwunpack.c b/libclamav/wwunpack.c
index 38c18081c..a13550e8f 100644
--- a/libclamav/wwunpack.c
+++ b/libclamav/wwunpack.c
@@ -226,13 +226,10 @@ int wwunpack(uint8_t *exe, uint32_t exesz, uint8_t *wwsect, struct cli_exe_secti
return CL_EFORMAT;
exe[pe+6]=(uint8_t)scount;
exe[pe+7]=(uint8_t)(scount>>8);
- if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295, 4) ||
- !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva, 4) ||
- !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva+0x299, 4)) {
+ if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295, 4))
cli_dbgmsg("WWPack: unpack memory address out of bounds.\n");
- return CL_EFORMAT;
- }
- cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);
+ else
+ cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);
cli_writeint32(&exe[pe+0x50], cli_readint32(&exe[pe+0x50])-sects[scount].vsz);
structs = &exe[(0xffff&cli_readint32(&exe[pe+0x14]))+pe+0x18];
diff --git a/unit_tests/check_jsnorm.c b/unit_tests/check_jsnorm.c
index 7515a0c18..9587ea469 100644
--- a/unit_tests/check_jsnorm.c
+++ b/unit_tests/check_jsnorm.c
@@ -145,7 +145,7 @@ END_TEST
START_TEST (test_token_dval)
{
- int val = 0.12345;
+ double val = 0.12345;
yystype tok;
memset(&tok, 0, sizeof(tok));

View File

@ -128,6 +128,7 @@ Patch31: clamav-0.99.1-setsebool.patch
Patch32: fa15aa98c7d5e1d8fc22e818ebd089f2e53ebe1d.diff
Patch33: clamav-0.99.2-temp-cleanup.patch
Patch34: dfc00cd3301a42b571454b51a6102eecf58407bc.patch
Patch35: 60671e3deb1df6c626e5c7e13752c2eec1649f98.patch
Patch36: 586a5180287262070637c8943f2f7efd652e4a2c.patch
@ -462,6 +463,7 @@ The systemd initscripts for clamav-scanner.
%apply -n32 -p1 -b .openssl_1.1.0
%apply -n33 -p1 -b .temp-cleanup
%apply -n34 -p1 -b .CVE-2017-6420
%apply -n35 -p1 -b .CVE-2017-6420
%apply -n36 -p1 -b .CVE-2017-6418
%{?apply_end}