From 691f3202a0b0592fef825e8ca44b6f252449b731586c28c0c994df00baa6bb31 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 27 Aug 2021 08:02:39 +0000 Subject: [PATCH] Accepting request 914527 from home:AZhou:branches:multimedia:libs - Add ffmpeg-CVE-2021-38171.patch: Backport from upstream to fix adts_decode_extradata in libavformat/adtsenc.c in FFmpeg 4.4 does not check the init_get_bits return value (bsc#1189724). OBS-URL: https://build.opensuse.org/request/show/914527 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ffmpeg-4?expand=0&rev=169 --- ffmpeg-4.changes | 7 +++++++ ffmpeg-4.spec | 1 + ffmpeg-CVE-2021-38171.patch | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 ffmpeg-CVE-2021-38171.patch diff --git a/ffmpeg-4.changes b/ffmpeg-4.changes index 5039d09..02de233 100644 --- a/ffmpeg-4.changes +++ b/ffmpeg-4.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Aug 27 07:09:15 UTC 2021 - Alynx Zhou + +- Add ffmpeg-CVE-2021-38171.patch: Backport from upstream to fix + adts_decode_extradata in libavformat/adtsenc.c in FFmpeg 4.4 + does not check the init_get_bits return value (bsc#1189724). + ------------------------------------------------------------------- Tue Aug 10 09:38:39 UTC 2021 - Alynx Zhou diff --git a/ffmpeg-4.spec b/ffmpeg-4.spec index 503a1a2..212041c 100644 --- a/ffmpeg-4.spec +++ b/ffmpeg-4.spec @@ -120,6 +120,7 @@ Patch8: vmaf-trim-usr-local.patch Patch9: ffmpeg-4.4-CVE-2020-22046.patch Patch10: ffmpeg-CVE-2021-33815.patch Patch11: ffmpeg-CVE-2021-38114.patch +Patch12: ffmpeg-CVE-2021-38171.patch BuildRequires: ladspa-devel BuildRequires: libgsm-devel BuildRequires: libmp3lame-devel diff --git a/ffmpeg-CVE-2021-38171.patch b/ffmpeg-CVE-2021-38171.patch new file mode 100644 index 0000000..3473379 --- /dev/null +++ b/ffmpeg-CVE-2021-38171.patch @@ -0,0 +1,36 @@ +From 9ffa49496d1aae4cbbb387aac28a9e061a6ab0a6 Mon Sep 17 00:00:00 2001 +From: maryam ebrahimzadeh +Date: Wed, 4 Aug 2021 16:15:18 -0400 +Subject: [PATCH] avformat/adtsenc: return value check for init_get_bits in + adts_decode_extradata + +As the second argument for init_get_bits (buf) can be crafted, a return value check for this function call is necessary. +'buf' is part of 'AVPacket pkt'. +replace init_get_bits with init_get_bits8. + +Signed-off-by: Michael Niedermayer +--- + libavformat/adtsenc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c +index ba15c0a724..3924e678d9 100644 +--- a/libavformat/adtsenc.c ++++ b/libavformat/adtsenc.c +@@ -53,9 +53,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui + GetBitContext gb; + PutBitContext pb; + MPEG4AudioConfig m4ac; +- int off; ++ int off, ret; + +- init_get_bits(&gb, buf, size * 8); ++ ret = init_get_bits8(&gb, buf, size); ++ if (ret < 0) ++ return ret; + off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s); + if (off < 0) + return off; +-- +2.33.0 +