summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch')
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch
new file mode 100644
index 0000000000..abfc024820
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2021-3566.patch
@@ -0,0 +1,61 @@
1From 3bce9e9b3ea35c54bacccc793d7da99ea5157532 Mon Sep 17 00:00:00 2001
2From: Paul B Mahol <onemda@gmail.com>
3Date: Mon, 27 Jan 2020 21:53:08 +0100
4Subject: [PATCH] avformat/tty: add probe function
5
6CVE: CVE-2021-3566
7Signed-off-by: Saloni Jain <salonij@kpit.com>
8
9Upstream-Status: Backport [http://git.videolan.org/?p=ffmpeg.git;a=patch;h=3bce9e9b3ea35c54bacccc793d7da99ea5157532]
10Comment: No changes/refreshing done.
11---
12 libavformat/tty.c | 21 ++++++++++++++++++++-
13 1 file changed, 20 insertions(+), 1 deletion(-)
14
15diff --git a/libavformat/tty.c b/libavformat/tty.c
16index 8d48f2c45c12..60f7e9f87ee7 100644
17--- a/libavformat/tty.c
18+++ b/libavformat/tty.c
19@@ -34,6 +34,13 @@
20 #include "internal.h"
21 #include "sauce.h"
22
23+static int isansicode(int x)
24+{
25+ return x == 0x1B || x == 0x0A || x == 0x0D || (x >= 0x20 && x < 0x7f);
26+}
27+
28+static const char tty_extensions[31] = "ans,art,asc,diz,ice,nfo,txt,vt";
29+
30 typedef struct TtyDemuxContext {
31 AVClass *class;
32 int chars_per_frame;
33@@ -42,6 +49,17 @@ typedef struct TtyDemuxContext {
34 AVRational framerate; /**< Set by a private option. */
35 } TtyDemuxContext;
36
37+static int read_probe(const AVProbeData *p)
38+{
39+ int cnt = 0;
40+
41+ for (int i = 0; i < p->buf_size; i++)
42+ cnt += !!isansicode(p->buf[i]);
43+
44+ return (cnt * 100LL / p->buf_size) * (cnt > 400) *
45+ !!av_match_ext(p->filename, tty_extensions);
46+}
47+
48 /**
49 * Parse EFI header
50 */
51@@ -153,8 +171,9 @@ AVInputFormat ff_tty_demuxer = {
52 .name = "tty",
53 .long_name = NULL_IF_CONFIG_SMALL("Tele-typewriter"),
54 .priv_data_size = sizeof(TtyDemuxContext),
55+ .read_probe = read_probe,
56 .read_header = read_header,
57 .read_packet = read_packet,
58- .extensions = "ans,art,asc,diz,ice,nfo,txt,vt",
59+ .extensions = tty_extensions,
60 .priv_class = &tty_demuxer_class,
61 };