Skip to content

Commit 42b4593

Browse files
authored
improved coverage for python (#599)
1 parent 1834d4b commit 42b4593

File tree

5 files changed

+75
-3
lines changed

5 files changed

+75
-3
lines changed

cve_bin_tool/checkers/python.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ def get_version(lines, filename):
6868
elif guess_contains_python(lines):
6969
version_info["is_or_contains"] = "contains"
7070

71-
elif "python" in lines:
72-
version_info["is_or_contains"] = "is"
73-
7471
if "is_or_contains" in version_info:
7572
version_info["modulename"] = "python"
7673
version_info["version"] = guess_version(lines)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
printf("This program is designed to test the cve-bin-tool checker.");
5+
printf("It outputs a few strings normally associated with python 3.7.1.");
6+
printf("They appear below this line.");
7+
printf("------------------");
8+
printf("3.7.1");
9+
printf("Fatal Python error: unable to decode the command line argument");
10+
11+
return 0;
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
printf("This program is designed to test the cve-bin-tool checker.");
5+
printf("It outputs a few strings normally associated with python 3.7.1.");
6+
printf("They appear below this line.");
7+
printf("------------------");
8+
printf("3.7.1");
9+
printf("CPython");
10+
11+
return 0;
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
printf("This program is designed to test the cve-bin-tool checker.");
5+
printf("It outputs a few strings normally associated with python 3.7.1.");
6+
printf("They appear below this line.");
7+
printf("------------------");
8+
printf("3.7.1");
9+
printf("Internal error in the Python interpreter");
10+
11+
return 0;
12+
}

test/test_scanner.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,45 @@ def _file_test(self, url, filename, package, version):
988988
"CVE-2017-17522"
989989
],
990990
),
991+
(
992+
"test-py_thon-3.7.1_1.out",
993+
"python",
994+
"3.7.1",
995+
[
996+
# Check for known cves in this version
997+
"CVE-2019-16935"
998+
],
999+
[
1000+
# Check to make sure an older CVE isn't included
1001+
"CVE-2017-17522"
1002+
],
1003+
),
1004+
(
1005+
"test-py_thon-3.7.1_2.out",
1006+
"python",
1007+
"3.7.1",
1008+
[
1009+
# Check for known cves in this version
1010+
"CVE-2019-16935"
1011+
],
1012+
[
1013+
# Check to make sure an older CVE isn't included
1014+
"CVE-2017-17522"
1015+
],
1016+
),
1017+
(
1018+
"test-py_thon-3.7.1_3.out",
1019+
"python",
1020+
"3.7.1",
1021+
[
1022+
# Check for known cves in this version
1023+
"CVE-2019-16935"
1024+
],
1025+
[
1026+
# Check to make sure an older CVE isn't included
1027+
"CVE-2017-17522"
1028+
],
1029+
),
9911030
(
9921031
"test-python-3.7.2.out",
9931032
"python",

0 commit comments

Comments
 (0)