Skip to content

Commit 160a704

Browse files
committed
fix: Be flexible in zlib versions
- Support versions with major.minor version number only - Support versions with more than one digit in the revision number
1 parent 76993fa commit 160a704

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

cve_bin_tool/checkers/zlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class ZlibChecker(Checker):
2626
]
2727
FILENAME_PATTERNS = [r"libz.so."]
2828
VERSION_PATTERNS = [
29-
r"deflate ([01]+\.[0-9]+\.[0-9]+) ",
30-
r"inflate ([01]+\.[0-9]+\.[0-9]+) ",
31-
r"libz.so.([01]+\.[0-9]+\.[0-9]+)", # patterns like this aren't ideal
29+
r"deflate ([01]+\.[0-9]+(?:\.[0-9]+)?) ",
30+
r"inflate ([01]+\.[0-9]+(?:\.[0-9]+)?) ",
31+
r"libz.so.([01]+\.[0-9]+(?:\.[0-9]+)?)", # patterns like this aren't ideal
3232
]
3333
VENDOR_PRODUCT = [("gnu", "zlib"), ("zlib", "zlib")]
3434

Binary file not shown.

test/test_data/zlib.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
"product": "zlib",
77
"version": "1.2.2",
88
"version_strings": ["deflate 1.2.2 Copyright 1995-2005 Jean-loup Gailly"],
9-
}
9+
},
10+
{
11+
"product": "zlib",
12+
"version": "1.3",
13+
"version_strings": [
14+
"deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler"
15+
],
16+
},
17+
{
18+
"product": "zlib",
19+
"version": "1.2.11",
20+
"version_strings": [
21+
"deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler"
22+
],
23+
},
1024
]
1125
package_test_data = [
1226
{
@@ -27,4 +41,10 @@
2741
"product": "zlib",
2842
"version": "1.2.8",
2943
},
44+
{
45+
"url": "https://ftp.nluug.nl/pub/os/windows/msys2/builds/mingw/mingw64/",
46+
"package_name": "mingw-w64-x86_64-zlib-1.3-1-any.pkg.tar.zst",
47+
"product": "zlib",
48+
"version": "1.3",
49+
},
3050
]

0 commit comments

Comments
 (0)