Skip to content

Commit 400528f

Browse files
authored
fix: Be more flexible in GCC detection logic (#4755)
1 parent c024705 commit 400528f

23 files changed

+33
-3
lines changed

cve_bin_tool/checkers/gcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GccChecker(Checker):
3232
]
3333
FILENAME_PATTTERN = [r"gcc"]
3434
VERSION_PATTERNS = [
35-
r"GCC: \(GNU\) ([0-9]+\.[0-9]+(\.[0-9]+)?)",
35+
r"GCC: \([a-zA-Z ,0-9]+\) ([0-9]+\.[0-9]+(\.[0-9]+)?)",
3636
# r"gcc ([0-9]+\.[0-9]+(\.[0-9]+)?)", # does not return correct version number on some packages
3737
]
3838
VENDOR_PRODUCT = [("gnu", "gcc")]

test/test_data/bzip2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"package_name": "bzip2-1.0.8.tgz",
3232
"product": "bzip2",
3333
"version": "1.0.8",
34+
"other_products": ["gcc"],
3435
},
3536
{
3637
"url": "http://archive.ubuntu.com/ubuntu/pool/main/b/bzip2/",

test/test_data/cairo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"package_name": "mingw-w64-ucrt-x86_64-cairo-1.18.2-2-any.pkg.tar.zst",
1515
"product": "cairo",
1616
"version": "1.18.2",
17+
"other_products": ["gcc"],
1718
},
1819
{
1920
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/c/",

test/test_data/curl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"package_name": "curl-7.77.0.tgz",
1919
"product": "curl",
2020
"version": "7.77.0",
21-
"other_products": ["libcurl"],
21+
"other_products": ["libcurl", "gcc"],
2222
},
2323
{
2424
"url": "http://ftp.debian.org/debian/pool/main/c/curl/",

test/test_data/dovecot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"package_name": "dovecot-2.3.15.tgz",
3232
"product": "dovecot",
3333
"version": "2.3.15",
34+
"other_products": ["gcc"],
3435
},
3536
{
3637
"url": "http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/",

test/test_data/freeradius.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"package_name": "freeradius-3.0.21nb3.tgz",
2727
"product": "freeradius",
2828
"version": "3.0.21",
29+
"other_products": ["gcc"],
2930
},
3031
{
3132
"url": "http://ftp.debian.org/debian/pool/main/f/freeradius/",

test/test_data/gcc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
"version": "9.1",
1313
"version_strings": ["GCC: (GNU) 9.1"],
1414
},
15+
{
16+
"product": "gcc",
17+
"version": "8.2.0",
18+
"version_strings": ["GCC: (Rev3, Built by MSYS2 project) 8.2.0"],
19+
},
1520
]
1621
package_test_data = [
1722
{
@@ -26,4 +31,11 @@
2631
"product": "gcc",
2732
"version": "8.4.1",
2833
},
34+
{
35+
"url": "https://mirror.msys2.org/mingw/ucrt64/",
36+
"package_name": "mingw-w64-ucrt-x86_64-zlib-1.3.1-1-any.pkg.tar.zst",
37+
"product": "gcc",
38+
"version": "13.2.0",
39+
"other_products": ["zlib"],
40+
},
2941
]

test/test_data/gnupg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
"package_name": "gnupg-1.4.23nb11.tgz",
3939
"product": "gnupg",
4040
"version": "1.4.23",
41+
"other_products": ["gcc"],
4142
},
4243
]

test/test_data/hdf5.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"package_name": "hdf5-1.10.6.tgz",
2525
"product": "hdf5",
2626
"version": "1.10.6",
27+
"other_products": ["gcc"],
2728
},
2829
{
2930
"url": "https://download-ib01.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/h/",

0 commit comments

Comments
 (0)