Skip to content

Commit a74d1ad

Browse files
authored
feat(checker): add zstandard checker (#3590)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 6cd07c4 commit a74d1ad

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
"zlib",
349349
"znc",
350350
"zsh",
351+
"zstandard",
351352
]
352353

353354
VendorProductPair = collections.namedtuple("VendorProductPair", ["vendor", "product"])

cve_bin_tool/checkers/zstandard.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for zstandard:
7+
8+
https://www.cvedetails.com/product/57378/Facebook-Zstandard.html?vendor_id=7758
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class ZstandardChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [
20+
r"Frame requires too much memory for decoding[a-zA-Z :(#$'/\r\n]*([0-9]+\.[0-9]+\.[0-9]+)",
21+
r"\r?\n([0-9]+\.[0-9]+\.[0-9]+)[a-zA-Z0-9 -|<>/._=%:(#$'/\[\]\r\n]*Frame requires too much memory for decoding",
22+
]
23+
VENDOR_PRODUCT = [("facebook", "zstandard")]
50.9 KB
Binary file not shown.
113 KB
Binary file not shown.
241 KB
Binary file not shown.

test/test_data/grub2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
"package_name": "grub2-2.06-150400.11.5.2.aarch64.rpm",
1111
"product": "grub2",
1212
"version": "2.06",
13+
"other_products": ["zstandard"],
1314
},
1415
{
1516
"url": "http://rpmfind.net/linux/opensuse/distribution/leap/15.5/repo/oss/ppc64le/",
1617
"package_name": "grub2-2.06-150400.11.5.2.ppc64le.rpm",
1718
"product": "grub2",
1819
"version": "2.06",
20+
"other_products": ["zstandard"],
1921
},
2022
{
2123
"url": "http://ftp.fr.debian.org/debian/pool/main/g/grub2/",

test/test_data/zstandard.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{
6+
"product": "zstandard",
7+
"version": "1.4.0",
8+
"version_strings": ["Frame requires too much memory for decoding/n1.4.0"],
9+
}
10+
]
11+
package_test_data = [
12+
{
13+
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/l/",
14+
"package_name": "libzstd-1.5.2-3.fc37.aarch64.rpm",
15+
"product": "zstandard",
16+
"version": "1.5.2",
17+
},
18+
{
19+
"url": "http://ftp.fr.debian.org/debian/pool/main/libz/libzstd/",
20+
"package_name": "libzstd1_1.3.8+dfsg-3+deb10u2_amd64.deb",
21+
"product": "zstandard",
22+
"version": "1.3.8",
23+
},
24+
{
25+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
26+
"package_name": "libzstd_1.4.5-2_x86_64.ipk",
27+
"product": "zstandard",
28+
"version": "1.4.5",
29+
},
30+
]

0 commit comments

Comments
 (0)