summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarpat Mali <narpat.mali@windriver.com>2023-01-19 17:16:57 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-26 23:37:05 +0000
commitbba70ce34115151362bfdc49a545ee708eb297ca (patch)
tree3bed5de84c57f75e1ab5646cf11f0a8401f4b43f
parentdb86e513430913d5f403d67addccab45aceb99ca (diff)
downloadpoky-bba70ce34115151362bfdc49a545ee708eb297ca.tar.gz
ffmpeg: fix for CVE-2022-3341
avformat/nutdec: Add check for avformat_new_stream Check for failure of avformat_new_stream() and propagate the error code. (From OE-Core rev: e17ddd0fafb562ed7ebe7708dac9bcef2d6cecc1) Signed-off-by: Narpat Mali <narpat.mali@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch67
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.1.bb3
2 files changed, 69 insertions, 1 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch
new file mode 100644
index 0000000000..41d5884f88
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch
@@ -0,0 +1,67 @@
1From 9cf652cef49d74afe3d454f27d49eb1a1394951e Mon Sep 17 00:00:00 2001
2From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
3Date: Wed, 23 Feb 2022 10:31:59 +0800
4Subject: [PATCH] avformat/nutdec: Add check for avformat_new_stream
5
6Check for failure of avformat_new_stream() and propagate
7the error code.
8
9Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10
11CVE: CVE-2022-3341
12
13Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/9cf652cef49d74afe3d454f27d49eb1a1394951e]
14
15Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
16---
17 libavformat/nutdec.c | 16 ++++++++++++----
18 1 file changed, 12 insertions(+), 4 deletions(-)
19
20diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
21index 0a8a700acf..f9ad2c0af1 100644
22--- a/libavformat/nutdec.c
23+++ b/libavformat/nutdec.c
24@@ -351,8 +351,12 @@ static int decode_main_header(NUTContext *nut)
25 ret = AVERROR(ENOMEM);
26 goto fail;
27 }
28- for (i = 0; i < stream_count; i++)
29- avformat_new_stream(s, NULL);
30+ for (i = 0; i < stream_count; i++) {
31+ if (!avformat_new_stream(s, NULL)) {
32+ ret = AVERROR(ENOMEM);
33+ goto fail;
34+ }
35+ }
36
37 return 0;
38 fail:
39@@ -800,19 +804,23 @@ static int nut_read_header(AVFormatContext *s)
40 NUTContext *nut = s->priv_data;
41 AVIOContext *bc = s->pb;
42 int64_t pos;
43- int initialized_stream_count;
44+ int initialized_stream_count, ret;
45
46 nut->avf = s;
47
48 /* main header */
49 pos = 0;
50+ ret = 0;
51 do {
52+ if (ret == AVERROR(ENOMEM))
53+ return ret;
54+
55 pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
56 if (pos < 0 + 1) {
57 av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
58 return AVERROR_INVALIDDATA;
59 }
60- } while (decode_main_header(nut) < 0);
61+ } while ((ret = decode_main_header(nut)) < 0);
62
63 /* stream headers */
64 pos = 0;
65--
662.34.1
67
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.1.bb
index c5bebe9c2d..4bcbda9976 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.1.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.1.bb
@@ -27,7 +27,8 @@ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
27 file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \ 27 file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \
28 file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \ 28 file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \
29 file://0001-avcodec-vp3-Add-missing-check-for-av_malloc.patch \ 29 file://0001-avcodec-vp3-Add-missing-check-for-av_malloc.patch \
30 " 30 file://0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch \
31 "
31 32
32SRC_URI[sha256sum] = "ef2efae259ce80a240de48ec85ecb062cecca26e4352ffb3fda562c21a93007b" 33SRC_URI[sha256sum] = "ef2efae259ce80a240de48ec85ecb062cecca26e4352ffb3fda562c21a93007b"
33 34