Skip to content

Commit 5e6ef5d

Browse files
committed
fix: Support zlib versions with major.minor version number only
zlib has a version 1.3 (without a revision), so make the third digit in the version number optional.
1 parent c071b6d commit 5e6ef5d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
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

test/test_data/zlib.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"product": "zlib",
77
"version": "1.2.2",
88
"version_strings": ["deflate 1.2.2 Copyright 1995-2005 Jean-loup Gailly"],
9+
},
10+
{
11+
"product": "zlib",
12+
"version": "1.3",
13+
"version_strings": ["deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler"],
914
}
1015
]
1116
package_test_data = [
@@ -27,4 +32,10 @@
2732
"product": "zlib",
2833
"version": "1.2.8",
2934
},
35+
{
36+
"url": "https://ftp.nluug.nl/pub/os/windows/msys2/builds/mingw/mingw64/",
37+
"package_name": "mingw-w64-x86_64-zlib-1.3-1-any.pkg.tar.zst",
38+
"product": "zlib",
39+
"version": "1.3",
40+
},
3041
]

0 commit comments

Comments
 (0)