From 5edfc0ef8d704963f166e9b670ba0efbe80a0dfc Mon Sep 17 00:00:00 2001 From: Saurabh Khandelwal Date: Sun, 29 Mar 2020 06:31:33 +0530 Subject: [PATCH] Add test using real files for zlib --- test/binaries/test-zlib-1.2.2.c | 12 ++++++++++++ test/test_scanner.py | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/binaries/test-zlib-1.2.2.c diff --git a/test/binaries/test-zlib-1.2.2.c b/test/binaries/test-zlib-1.2.2.c new file mode 100644 index 0000000000..57b0d3847d --- /dev/null +++ b/test/binaries/test-zlib-1.2.2.c @@ -0,0 +1,12 @@ +#include + +int main() { + printf("This program is designed to test the cve-bin-tool checker."); + printf("It outputs a few strings normally associated with zlib 1.2.2"); + printf("They appear below this line."); + printf("------------------"); + printf("deflate 1.2.2 "); + printf("too many length or distance symbols"); + + return 0; +} diff --git a/test/test_scanner.py b/test/test_scanner.py index a070bfc83d..2fc9c7341c 100644 --- a/test/test_scanner.py +++ b/test/test_scanner.py @@ -830,6 +830,20 @@ def _file_test(self, url, filename, package, version): "CVE-2018-7208", ], ), + ( + "test-zlib-1.2.2.out", + "zlib", + "1.2.2", + [ + # Check for known cves in this version + "CVE-2005-2096", + "CVE-2005-1849", + ], + [ + # Check to make sure an older CVE isn't included + "CVE-2016-9843" + ], + ), ], ) def test_binaries(self, binary, package, version, are_in, not_in): @@ -1087,6 +1101,18 @@ def test_binaries(self, binary, package, version, are_in, not_in): "binutils", "2.27", ), + ( + "http://mirror.centos.org/centos/7/os/x86_64/Packages/", + "zlib-1.2.7-18.el7.x86_64.rpm", + "zlib", + "1.2.7", + ), + ( + "http://archive.ubuntu.com/ubuntu/pool/universe/z/zlib/", + "zlib-bin_1.2.8.dfsg-1ubuntu1.1_amd64.deb", + "zlib", + "1.2.8", + ), ], list( map(