Skip to content

Commit 9262952

Browse files
authored
feat(checkers): Add clang (#4754)
1 parent 76993fa commit 9262952

File tree

6 files changed

+42
-2
lines changed

6 files changed

+42
-2
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"chess",
5757
"chrony",
5858
"civetweb",
59+
"clang",
5960
"clamav",
6061
"collectd",
6162
"commons_compress",

cve_bin_tool/checkers/clang.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2025 Keysight Technologies
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for clang
7+
8+
https://www.cvedetails.com/product/27514/Llvm-Clang.html?vendor_id=13260
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class ClangChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [r"Clang ([0-9]+\.[0-9]+\.[0-9]+)"]
20+
VENDOR_PRODUCT = [("llvm", "clang")]
Binary file not shown.

test/test_data/clamav.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"package_name": "clamav-0.105.1-1-omv4090.aarch64.rpm",
1818
"product": "clamav",
1919
"version": "0.105.1",
20-
"other_products": ["rust"],
20+
"other_products": ["rust", "clang"],
2121
},
2222
{
2323
"url": "http://rpmfind.net/linux/openmandriva/cooker/repository/x86_64/main/release/",
2424
"package_name": "clamav-0.105.1-1-omv4090.x86_64.rpm",
2525
"product": "clamav",
2626
"version": "0.105.1",
27-
"other_products": ["rust"],
27+
"other_products": ["rust", "clang"],
2828
},
2929
{
3030
"url": "http://ftp.debian.org/debian/pool/main/c/clamav/",

test/test_data/clang.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (C) 2025 Keysight Technologies
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{
6+
"product": "clang",
7+
"version": "7.0.0",
8+
"version_strings": ["Clang 7.0.0"],
9+
}
10+
]
11+
package_test_data = [
12+
{
13+
"url": "http://de.archive.ubuntu.com/ubuntu/pool/universe/l/llvm-toolchain-19/",
14+
"package_name": "libclang1-19_19.1.1-1ubuntu1_amd64.deb",
15+
"product": "clang",
16+
"version": "19.1.1",
17+
},
18+
]

test/test_data/dotnet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"product": ".net",
1313
"version": "7.0.11",
1414
"package_name": "dotnet-runtime-7.0-7.0.11-1.fc39.aarch64.rpm",
15+
"other_products": ["clang"],
1516
},
1617
]

0 commit comments

Comments
 (0)