Skip to content

Commit

Permalink
feat(checker): add zstandard checker
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine committed Dec 13, 2023
1 parent fbcbbd6 commit 61b2276
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
"zlib",
"znc",
"zsh",
"zstandard",
]

VendorProductPair = collections.namedtuple("VendorProductPair", ["vendor", "product"])
Expand Down
22 changes: 22 additions & 0 deletions cve_bin_tool/checkers/zstandard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for zstandard:
https://www.cvedetails.com/product/57378/Facebook-Zstandard.html?vendor_id=7758
"""

from cve_bin_tool.checkers import Checker


class ZstandardChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [
r"Frame requires too much memory for decoding[a-zA-Z :(#$'/\r\n]*([0-9]+\.[0-9]+\.[0-9]+)",
r"([0-9]+\.[0-9]+\.[0-9]+)[a-zA-Z0-9 -|<>/._=%:(#$'/\[\]\r\n]*Frame requires too much memory for decoding",
]
VENDOR_PRODUCT = [("facebook", "zstandard")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions test/test_data/zstandard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{
"product": "zstandard",
"version": "1.4.0",
"version_strings": ["Frame requires too much memory for decoding/n1.4.0"],
}
]
package_test_data = [
{
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/l/",
"package_name": "libzstd-1.5.2-3.fc37.aarch64.rpm",
"product": "zstandard",
"version": "1.5.2",
},
{
"url": "http://ftp.fr.debian.org/debian/pool/main/libz/libzstd/",
"package_name": "libzstd1_1.3.8+dfsg-3+deb10u2_amd64.deb",
"product": "zstandard",
"version": "1.3.8",
},
{
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
"package_name": "libzstd_1.4.5-2_x86_64.ipk",
"product": "zstandard",
"version": "1.4.5",
},
]

0 comments on commit 61b2276

Please sign in to comment.