summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchana Polampalli <archana.polampalli@windriver.com>2024-07-24 09:56:24 +0000
committerSteve Sakoman <steve@sakoman.com>2024-08-01 06:08:08 -0700
commit11415e5a611eb5d1e62d0175022fac73332192a5 (patch)
tree10a3d9c27d6c3e265c4746af94addc42bc6d5465
parentd6875b5240aed6bf3b5181deaff079f11dfee2d4 (diff)
downloadpoky-11415e5a611eb5d1e62d0175022fac73332192a5.tar.gz
ffmpeg: fix CVE-2023-49502
Buffer Overflow vulnerability in Ffmpeg v.n6.1-3-g466799d4f5 allows a local attacker to execute arbitrary code via the ff_bwdif_filter_intra_c function in the libavfilter/bwdifdsp.c:125:5 component. (From OE-Core rev: 814a688d1dc3f22cf7d1b88bde6842b032c13d12) Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2023-49502.patch107
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb1
2 files changed, 108 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2023-49502.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2023-49502.patch
new file mode 100644
index 0000000000..bc78a46d03
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2023-49502.patch
@@ -0,0 +1,107 @@
1From 737ede405b11a37fdd61d19cf25df296a0cb0b75 Mon Sep 17 00:00:00 2001
2From: Cosmin Stejerean <cosmin@cosmin.at>
3Date: Wed, 6 Dec 2023 18:39:32 +0800
4Subject: [PATCH] avfilter/bwdif: account for chroma sub-sampling in min size
5 calculation
6
7The current logic for detecting frames that are too small for the
8algorithm does not account for chroma sub-sampling, and so a sample
9where the luma plane is large enough, but the chroma planes are not
10will not be rejected. In that event, a heap overflow will occur.
11
12This change adjusts the logic to consider the chroma planes and makes
13the change to all three bwdif implementations.
14
15Fixes #10688
16
17Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
18Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
19Signed-off-by: Philip Langdale <philipl@overt.org>
20
21CVE: CVE-2023-49502
22
23Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/737ede405b11a37f]
24
25Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
26---
27 libavfilter/vf_bwdif.c | 9 +++++----
28 libavfilter/vf_bwdif_cuda.c | 11 ++++++-----
29 libavfilter/vf_bwdif_vulkan.c | 11 +++++------
30 3 files changed, 16 insertions(+), 15 deletions(-)
31
32diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
33index 137cd5e..353cd0b 100644
34--- a/libavfilter/vf_bwdif.c
35+++ b/libavfilter/vf_bwdif.c
36@@ -191,13 +191,14 @@ static int config_props(AVFilterLink *link)
37 return ret;
38 }
39
40- if (link->w < 3 || link->h < 4) {
41- av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");
42+ yadif->csp = av_pix_fmt_desc_get(link->format);
43+ yadif->filter = filter;
44+
45+ if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) {
46+ av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
47 return AVERROR(EINVAL);
48 }
49
50- yadif->csp = av_pix_fmt_desc_get(link->format);
51- yadif->filter = filter;
52 ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth);
53
54 return 0;
55diff --git a/libavfilter/vf_bwdif_cuda.c b/libavfilter/vf_bwdif_cuda.c
56index a5ecfba..418f15f 100644
57--- a/libavfilter/vf_bwdif_cuda.c
58+++ b/libavfilter/vf_bwdif_cuda.c
59@@ -296,15 +296,16 @@ static int config_output(AVFilterLink *link)
60 link->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
61 (AVRational){2, 1});
62
63- if (link->w < 3 || link->h < 3) {
64- av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
65- ret = AVERROR(EINVAL);
66- goto exit;
67- }
68
69 y->csp = av_pix_fmt_desc_get(output_frames->sw_format);
70 y->filter = filter;
71
72+ if (AV_CEIL_RSHIFT(link->w, y->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, y->csp->log2_chroma_h) < 3) {
73+ av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or lines is not supported\n");
74+ ret = AVERROR(EINVAL);
75+ goto exit;
76+ }
77+
78 ret = CHECK_CU(cu->cuCtxPushCurrent(s->hwctx->cuda_ctx));
79 if (ret < 0)
80 goto exit;
81diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
82index 690a89c..c51df9a 100644
83--- a/libavfilter/vf_bwdif_vulkan.c
84+++ b/libavfilter/vf_bwdif_vulkan.c
85@@ -362,15 +362,14 @@ static int bwdif_vulkan_config_output(AVFilterLink *outlink)
86 outlink->frame_rate = av_mul_q(avctx->inputs[0]->frame_rate,
87 (AVRational){2, 1});
88
89- if (outlink->w < 4 || outlink->h < 4) {
90- av_log(avctx, AV_LOG_ERROR, "Video of less than 4 columns or lines is not "
91- "supported\n");
92- return AVERROR(EINVAL);
93- }
94-
95 y->csp = av_pix_fmt_desc_get(vkctx->frames->sw_format);
96 y->filter = bwdif_vulkan_filter_frame;
97
98+ if (AV_CEIL_RSHIFT(outlink->w, y->csp->log2_chroma_w) < 4 || AV_CEIL_RSHIFT(outlink->h, y->csp->log2_chroma_h) < 4) {
99+ av_log(avctx, AV_LOG_ERROR, "Video with planes less than 4 columns or lines is not supported\n");
100+ return AVERROR(EINVAL);
101+ }
102+
103 return init_filter(avctx);
104 }
105
106--
1072.40.0
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb
index dea1f54580..90c15782d1 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb
@@ -27,6 +27,7 @@ SRC_URI = " \
27 file://av1_ordering_info.patch \ 27 file://av1_ordering_info.patch \
28 file://vulkan_av1_stable_API.patch \ 28 file://vulkan_av1_stable_API.patch \
29 file://vulkan_fix_gcc14.patch \ 29 file://vulkan_fix_gcc14.patch \
30 file://CVE-2023-49502.patch \
30" 31"
31 32
32SRC_URI[sha256sum] = "8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968" 33SRC_URI[sha256sum] = "8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968"