Skip to content

Commit 23ee40e

Browse files
committed
fix: Be more flexible in GCC detection logic
1 parent e6ee305 commit 23ee40e

20 files changed

+30
-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/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/",

test/test_data/icu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"package_name": "icu-68.2.tgz",
4343
"product": "international_components_for_unicode",
4444
"version": "68.2",
45+
"other_products": ["gcc"],
4546
},
4647
{
4748
"url": "https://rpmfind.net/linux/dag/redhat/el4/en/x86_64/dag/RPMS/",

test/test_data/irssi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"package_name": "irssi-1.2.3nb1.tgz",
2323
"product": "irssi",
2424
"version": "1.2.3",
25+
"other_products": ["gcc"],
2526
},
2627
{
2728
"url": "http://ftp.debian.org/debian/pool/main/i/irssi/",

test/test_data/kubernetes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"package_name": "kubernetes-client-1.18.0-lp152.1.4.x86_64.rpm",
1515
"product": "kubernetes",
1616
"version": "1.18.0",
17-
"other_products": ["go"],
17+
"other_products": ["go", "gcc"],
1818
},
1919
{
2020
"url": "http://ftp.debian.org/debian/pool/main/k/kubernetes/",

test/test_data/libarchive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"package_name": "libarchive-3.4.3.tgz",
3333
"product": "libarchive",
3434
"version": "3.4.3",
35+
"other_products": ["gcc"],
3536
},
3637
{
3738
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",

test/test_data/libical.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"package_name": "libical-3.0.9.tgz",
2121
"product": "libical",
2222
"version": "3.0.9",
23+
"other_products": ["gcc"],
2324
},
2425
{
2526
"url": "https://download-ib01.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/l/",

test/test_data/libsndfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"package_name": "libsndfile-1.0.31.tgz",
2727
"product": "libsndfile",
2828
"version": "1.0.31",
29+
"other_products": ["gcc"],
2930
},
3031
{
3132
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",

test/test_data/libsoup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
"package_name": "libsoup-2.70.0nb4.tgz",
3232
"product": "libsoup",
3333
"version": "2.70.0",
34+
"other_products": ["gcc"],
3435
},
3536
]

test/test_data/libssh2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
"package_name": "libssh2-1.9.0nb1.tgz",
3838
"product": "libssh2",
3939
"version": "1.9.0",
40+
"other_products": ["gcc"],
4041
},
4142
]

test/test_data/libvncserver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"package_name": "libVNCServer-0.9.13.tgz",
3939
"product": "libvncserver",
4040
"version": "0.9.13",
41+
"other_products": ["gcc"],
4142
},
4243
{
4344
"url": "http://archive.ubuntu.com/ubuntu/pool/main/libv/libvncserver/",

test/test_data/open_iscsi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"package_name": "open-iscsi-2.1.8-97.2.i586.rpm",
1515
"product": "open-iscsi",
1616
"version": "2.1.8",
17+
"other_products": ["gcc"],
1718
},
1819
{
1920
"url": "http://ftp.debian.org/debian/pool/main/o/open-iscsi/",

test/test_data/zsh.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"package_name": "zsh_5.8-6+b1_amd64.deb",
2323
"product": "zsh",
2424
"version": "5.8",
25+
"other_products": ["gcc"],
2526
},
2627
]

0 commit comments

Comments
 (0)