mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 03:32:12 +02:00
ffmpeg: fix CVE-2021-38291
backport from upstream (From OE-Core rev: cbb7b8cfbd4cfe6115e858e14f415d89d182f550) Signed-off-by: Kiran Surendran <kiran.surendran@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
cfc17a7ab5
commit
97bcb75926
@@ -0,0 +1,54 @@
|
||||
CVE: CVE-2021-38291
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Kiran Surendran <kiran.surendran@windriver.com>
|
||||
|
||||
From e908bdb157fa493be2b50e2a11055d19c5254a15 Mon Sep 17 00:00:00 2001
|
||||
From: James Almer <jamrial@gmail.com>
|
||||
Date: Wed, 21 Jul 2021 01:02:44 -0300
|
||||
Subject: [PATCH] avcodec/utils: don't return negative values in
|
||||
av_get_audio_frame_duration()
|
||||
|
||||
In some extrme cases, like with adpcm_ms samples with an extremely high channel
|
||||
count, get_audio_frame_duration() may return a negative frame duration value.
|
||||
Don't propagate it, and instead return 0, signaling that a duration could not
|
||||
be determined.
|
||||
|
||||
Fixes ticket #9312
|
||||
|
||||
Signed-off-by: James Almer <jamrial@gmail.com>
|
||||
---
|
||||
libavcodec/utils.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
|
||||
index 81e34254e8..5fdb10fe09 100644
|
||||
--- a/libavcodec/utils.c
|
||||
+++ b/libavcodec/utils.c
|
||||
@@ -1776,20 +1776,22 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||
|
||||
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
|
||||
{
|
||||
- return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate,
|
||||
+ int duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate,
|
||||
avctx->channels, avctx->block_align,
|
||||
avctx->codec_tag, avctx->bits_per_coded_sample,
|
||||
avctx->bit_rate, avctx->extradata, avctx->frame_size,
|
||||
frame_bytes);
|
||||
+ return FFMAX(0, duration);
|
||||
}
|
||||
|
||||
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
|
||||
{
|
||||
- return get_audio_frame_duration(par->codec_id, par->sample_rate,
|
||||
+ int duration = get_audio_frame_duration(par->codec_id, par->sample_rate,
|
||||
par->channels, par->block_align,
|
||||
par->codec_tag, par->bits_per_coded_sample,
|
||||
par->bit_rate, par->extradata, par->frame_size,
|
||||
frame_bytes);
|
||||
+ return FFMAX(0, duration);
|
||||
}
|
||||
|
||||
#if !HAVE_THREADS
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -31,6 +31,7 @@ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
|
||||
file://fix-CVE-2020-22015.patch \
|
||||
file://fix-CVE-2020-22021.patch \
|
||||
file://fix-CVE-2020-22033-CVE-2020-22019.patch \
|
||||
file://fix-CVE-2021-38291.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "46e4e64f1dd0233cbc0934b9f1c0da676008cad34725113fb7f802cfa84ccddb"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user