Skip to content

Commit

Permalink
fix: Support zlib versions with major.minor version number only
Browse files Browse the repository at this point in the history
zlib has a version 1.3 (without a revision), so make the third digit in the version number optional.
  • Loading branch information
qmfrederik committed Feb 1, 2025
1 parent 5ecff54 commit f14b7fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cve_bin_tool/checkers/zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class ZlibChecker(Checker):
]
FILENAME_PATTERNS = [r"libz.so."]
VERSION_PATTERNS = [
r"deflate ([01]+\.[0-9]+\.[0-9]+) ",
r"inflate ([01]+\.[0-9]+\.[0-9]+) ",
r"libz.so.([01]+\.[0-9]+\.[0-9]+)", # patterns like this aren't ideal
r"deflate ([01]+\.[0-9]+(?:\.[0-9])?) ",
r"inflate ([01]+\.[0-9]+(?:\.[0-9])?) ",
r"libz.so.([01]+\.[0-9]+(?:\.[0-9])?)", # patterns like this aren't ideal
]
VENDOR_PRODUCT = [("gnu", "zlib"), ("zlib", "zlib")]

Expand Down
11 changes: 11 additions & 0 deletions test/test_data/zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"product": "zlib",
"version": "1.2.2",
"version_strings": ["deflate 1.2.2 Copyright 1995-2005 Jean-loup Gailly"],
},
{
"product": "zlib",
"version": "1.3",
"version_strings": ["deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler"],
}
]
package_test_data = [
Expand All @@ -27,4 +32,10 @@
"product": "zlib",
"version": "1.2.8",
},
{
"url": "https://ftp.nluug.nl/pub/os/windows/msys2/builds/mingw/mingw64/",
"package_name": "mingw-w64-x86_64-zlib-1.3-1-any.pkg.tar.zst",
"product": "zlib",
"version": "1.3",
},
]

0 comments on commit f14b7fb

Please sign in to comment.