Skip to content

Commit d2777d8

Browse files
authored
Merge branch 'master' into nextPR
2 parents 1c02c90 + 5ccffc0 commit d2777d8

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ __pycache__/
88
htmlcov/
99
.coverage
1010
build/
11+
.eggs/*

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"bluez",
44
"curl",
55
"expat",
6+
"ffmpeg",
67
"gnutls",
78
"icu",
89
"kerberos",

cve_bin_tool/checkers/ffmpeg.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/python3
2+
3+
"""
4+
CVE checker for ffmpeg
5+
6+
References:
7+
https://www.ffmpeg.org/
8+
https://www.cvedetails.com/vulnerability-list/vendor_id-3611/Ffmpeg.html
9+
10+
Note: Some of the "first vulnerable in" data may not be entered correctly.
11+
"""
12+
from ..util import regex_find
13+
14+
15+
def get_version(lines, filename):
16+
"""returns version information for ffmpeg as found in a given file.
17+
The version info is returned as a tuple:
18+
[modulename, is_or_contains, version]
19+
20+
modulename will be ffmpeg if ffmpeg is found (and blank otherwise)
21+
is_or_contains indicates if the file is a copy of ffmpeg or contains one
22+
version gives the actual version number
23+
24+
VPkg: ffmpeg, ffmpeg
25+
"""
26+
is_ffmpeg = "Codec '%s' is not recognized by FFmpeg." in lines
27+
version_regex = [r"%s version ([0-9]+\.[0-9]+\.[0-9]+)"]
28+
version_info = dict()
29+
if filename[::-1].startswith(("ffmpeg")[::-1]):
30+
version_info["is_or_contains"] = "is"
31+
else:
32+
version_info["is_or_contains"] = "contains"
33+
34+
if "is_or_contains" in version_info:
35+
version_info["modulename"] = "ffmpeg"
36+
version_info["version"] = regex_find(lines, *version_regex)
37+
38+
return version_info

test/binaries/test-ffmpeg-4.1.4.c

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 ffmepg 4.1.3.");
6+
printf("They appear below this line.");
7+
printf("------------------");
8+
printf("Codec '%s' is not recognized by FFmpeg.", "whatever");
9+
printf("%s version 4.1.4", "FFmpeg");
10+
11+
return 0;
12+
}

test/test_scanner.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,22 @@ def test_expat_deb_2_2_0(self):
229229
"2.2.0",
230230
)
231231

232+
def test_ffmpeg_4_1_4(self):
233+
"""Scanning test-ffmpeg-4.1.4.out"""
234+
self._binary_test(
235+
"test-ffmpeg-4.1.4.out",
236+
"ffmpeg",
237+
"4.1.4",
238+
[
239+
# known cves in 4.1.4
240+
"CVE-2019-12730"
241+
],
242+
[
243+
# an older cve from before 4.1.4
244+
"CVE-2019-11339"
245+
],
246+
)
247+
232248
def test_jpeg_2_0_1(self):
233249
"""Scanning test-libjpeg-turbo-2.0.1"""
234250
self._binary_test(

0 commit comments

Comments
 (0)