Skip to content

Commit 153ab71

Browse files
authored
feat(checker): add ghostscript checker (#4379)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent fa6da29 commit 153ab71

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"gdal",
108108
"gdb",
109109
"gdk_pixbuf",
110+
"ghostscript",
110111
"gimp",
111112
"git",
112113
"gmp",

cve_bin_tool/checkers/ghostscript.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (C) 2024 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for ghostscript
7+
8+
https://www.cvedetails.com/product/12939/Ghostscript-Ghostscript.html?vendor_id=7640
9+
https://www.cvedetails.com/product/36469/Artifex-Ghostscript.html?vendor_id=10846
10+
11+
"""
12+
from __future__ import annotations
13+
14+
from cve_bin_tool.checkers import Checker
15+
16+
17+
class GhostscriptChecker(Checker):
18+
CONTAINS_PATTERNS: list[str] = []
19+
FILENAME_PATTERNS: list[str] = []
20+
VERSION_PATTERNS = [
21+
r"ghostscript/([0-9]+\.[0-9]+)",
22+
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\n[a-z:/]*ghostscript",
23+
]
24+
VENDOR_PRODUCT = [("artifex", "ghostscript"), ("ghostscript", "ghostscript")]
Binary file not shown.
Binary file not shown.

test/test_data/ghostscript.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2024 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{
6+
"product": "ghostscript",
7+
"version": "9.27",
8+
"version_strings": ["ghostscript/9.27"],
9+
},
10+
{
11+
"product": "ghostscript",
12+
"version": "10.03.1",
13+
"version_strings": ["10.03.1\nghostscript"],
14+
},
15+
]
16+
package_test_data = [
17+
{
18+
"url": "http://ftp.fr.debian.org/debian/pool/main/g/ghostscript/",
19+
"package_name": "libgs9_9.27~dfsg-2+deb10u5_amd64.deb",
20+
"product": "ghostscript",
21+
"version": "9.27",
22+
},
23+
{
24+
"url": "https://eu.mirror.archlinuxarm.org/aarch64/extra/",
25+
"package_name": "ghostscript-10.03.1-1-aarch64.pkg.tar.xz",
26+
"product": "ghostscript",
27+
"version": "10.03.1",
28+
"other_products": ["gcc"],
29+
},
30+
]

0 commit comments

Comments
 (0)