diff options
Diffstat (limited to 'meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch')
-rw-r--r-- | meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch new file mode 100644 index 0000000000..6b96bd674f --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From 27a99e2c7d450fef15594671eef4465c8a166bd7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Niedermayer <michael@niedermayer.cc> | ||
3 | Date: Wed, 28 Oct 2020 20:11:54 +0100 | ||
4 | Subject: [PATCH] avformat/vividas: improve extradata packing checks in | ||
5 | track_header() | ||
6 | |||
7 | Fixes: out of array accesses | ||
8 | Fixes: 26622/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6581200338288640 | ||
9 | |||
10 | Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg | ||
11 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> | ||
12 | |||
13 | Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/27a99e2c7d450fef15594671eef4465c8a166bd7] | ||
14 | |||
15 | CVE: CVE-2020-35964 | ||
16 | |||
17 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> | ||
18 | Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com> | ||
19 | --- | ||
20 | libavformat/vividas.c | 12 ++++++------ | ||
21 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
22 | |||
23 | diff --git a/libavformat/vividas.c b/libavformat/vividas.c | ||
24 | index 83d0ed116787..46c66bf9a0ae 100644 | ||
25 | --- a/libavformat/vividas.c | ||
26 | +++ b/libavformat/vividas.c | ||
27 | @@ -28,6 +28,7 @@ | ||
28 | * @sa http://wiki.multimedia.cx/index.php?title=Vividas_VIV | ||
29 | */ | ||
30 | |||
31 | +#include "libavutil/avassert.h" | ||
32 | #include "libavutil/intreadwrite.h" | ||
33 | #include "avio_internal.h" | ||
34 | #include "avformat.h" | ||
35 | @@ -379,7 +380,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * | ||
36 | |||
37 | if (avio_tell(pb) < off) { | ||
38 | int num_data; | ||
39 | - int xd_size = 0; | ||
40 | + int xd_size = 1; | ||
41 | int data_len[256]; | ||
42 | int offset = 1; | ||
43 | uint8_t *p; | ||
44 | @@ -393,10 +394,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * | ||
45 | return AVERROR_INVALIDDATA; | ||
46 | } | ||
47 | data_len[j] = len; | ||
48 | - xd_size += len; | ||
49 | + xd_size += len + 1 + len/255; | ||
50 | } | ||
51 | |||
52 | - ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255); | ||
53 | + ret = ff_alloc_extradata(st->codecpar, xd_size); | ||
54 | if (ret < 0) | ||
55 | return ret; | ||
56 | |||
57 | @@ -405,9 +406,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * | ||
58 | |||
59 | for (j = 0; j < num_data - 1; j++) { | ||
60 | unsigned delta = av_xiphlacing(&p[offset], data_len[j]); | ||
61 | - if (delta > data_len[j]) { | ||
62 | - return AVERROR_INVALIDDATA; | ||
63 | - } | ||
64 | + av_assert0(delta <= xd_size - offset); | ||
65 | offset += delta; | ||
66 | } | ||
67 | |||
68 | @@ -418,6 +417,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * | ||
69 | av_freep(&st->codecpar->extradata); | ||
70 | break; | ||
71 | } | ||
72 | + av_assert0(data_len[j] <= xd_size - offset); | ||
73 | offset += data_len[j]; | ||
74 | } | ||
75 | |||