Skip to content

Commit cbbdb92

Browse files
authored
feat(checker): add gzip checker (#2998)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 609a353 commit cbbdb92

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"gstreamer",
9999
"gupnp",
100100
"gvfs",
101+
"gzip",
101102
"haproxy",
102103
"harfbuzz",
103104
"haserl",

cve_bin_tool/checkers/gzip.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for gzip
7+
8+
https://www.cvedetails.com/product/1670/GNU-Gzip.html?vendor_id=72
9+
https://www.cvedetails.com/product/8772/Gzip-Gzip.html?vendor_id=5134
10+
11+
"""
12+
from __future__ import annotations
13+
14+
from cve_bin_tool.checkers import Checker
15+
16+
17+
class GzipChecker(Checker):
18+
CONTAINS_PATTERNS: list[str] = []
19+
FILENAME_PATTERNS: list[str] = []
20+
VERSION_PATTERNS = [
21+
r"file size changed while zipping\r?\n([0-9]+\.[0-9]+)",
22+
r"Written by Jean-loup Gailly.[a-zA-Z0-9:%,' \-\.\r\n]*\r?\n([0-9]+\.[0-9]+)",
23+
]
24+
VENDOR_PRODUCT = [("gnu", "gzip"), ("gzip", "gzip")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/gzip.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{
6+
"product": "gzip",
7+
"version": "1.10",
8+
"version_strings": ["file size changed while zipping\n1.10"],
9+
},
10+
{
11+
"product": "gzip",
12+
"version": "1.10",
13+
"version_strings": ["Written by Jean-loup Gailly.\n1.10"],
14+
},
15+
]
16+
package_test_data = [
17+
{
18+
"url": "http://rpmfind.net/linux/opensuse/ports/i586/tumbleweed/repo/oss/i586/",
19+
"package_name": "gzip-1.12-3.6.i586.rpm",
20+
"product": "gzip",
21+
"version": "1.12",
22+
},
23+
{
24+
"url": "http://ftp.fr.debian.org/debian/pool/main/g/gzip/",
25+
"package_name": "gzip_1.9-3+deb10u1_amd64.deb",
26+
"product": "gzip",
27+
"version": "1.9",
28+
},
29+
{
30+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
31+
"package_name": "gzip_1.10-2_x86_64.ipk",
32+
"product": "gzip",
33+
"version": "1.10",
34+
},
35+
]

0 commit comments

Comments
 (0)