From 2bf5dc5693128d4e23945b2621dcda52ca79ddd7 Mon Sep 17 00:00:00 2001 From: happyworker <208suo@208suo.com> Date: Wed, 3 Jul 2024 14:34:30 +0800 Subject: [PATCH] Fix CVE-2021-38171 CVE-2022-3109 CVE-2022-3341 fix-CVE-2023-50010 --- CVE-2021-38171.patch | 30 +++++++++++++++++++++ CVE-2022-3109.patch | 31 ++++++++++++++++++++++ CVE-2022-3341.patch | 57 ++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 22 +++++++++++++--- fix-CVE-2023-50010.patch | 25 ++++++++++++++++++ 5 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 CVE-2021-38171.patch create mode 100644 CVE-2022-3109.patch create mode 100644 CVE-2022-3341.patch create mode 100644 fix-CVE-2023-50010.patch diff --git a/CVE-2021-38171.patch b/CVE-2021-38171.patch new file mode 100644 index 0000000..20ac857 --- /dev/null +++ b/CVE-2021-38171.patch @@ -0,0 +1,30 @@ +From 98461501f4272822c310e18d74d5dc3e4b51631f Mon Sep 17 00:00:00 2001 +From: maryam ebrahimzadeh +Date: Tue, 2 Jul 2024 15:50:54 +0800 +Subject: [PATCH] CVE-2021-38171 + +--- + libavformat/adtsenc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c +index 3c2840c..3807d67 100644 +--- a/libavformat/adtsenc.c ++++ b/libavformat/adtsenc.c +@@ -50,9 +50,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_config(&m4ac, buf, size * 8, 1); + if (off < 0) + return off; +-- +2.43.0 + diff --git a/CVE-2022-3109.patch b/CVE-2022-3109.patch new file mode 100644 index 0000000..bdf06d0 --- /dev/null +++ b/CVE-2022-3109.patch @@ -0,0 +1,31 @@ +From ae0ca68362ee76165de00024e1454d2e3513eced Mon Sep 17 00:00:00 2001 +From: Jiasheng Jiang +Date: Wed, 26 Jun 2024 17:54:07 +0800 +Subject: [PATCH] CVE-2022-3109 + +--- + libavcodec/vp3.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c +index a2bd2ef..0c62731 100644 +--- a/libavcodec/vp3.c ++++ b/libavcodec/vp3.c +@@ -2740,8 +2740,13 @@ static int vp3_decode_frame(AVCodecContext *avctx, + if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 0) + goto error; + +- if (!s->edge_emu_buffer) ++ if (!s->edge_emu_buffer) { + s->edge_emu_buffer = av_malloc(9 * FFABS(s->current_frame.f->linesize[0])); ++ if (!s->edge_emu_buffer) { ++ ret = AVERROR(ENOMEM); ++ goto error; ++ } ++ } + + if (s->keyframe) { + if (!s->theora) { +-- +2.43.0 + diff --git a/CVE-2022-3341.patch b/CVE-2022-3341.patch new file mode 100644 index 0000000..aa695b9 --- /dev/null +++ b/CVE-2022-3341.patch @@ -0,0 +1,57 @@ +From 239f7c59a9512262a999ebed1e44c726e43bbe75 Mon Sep 17 00:00:00 2001 +From: Jiasheng Jiang +Date: Wed, 25 Jun 2024 10:05:47 +0800 +Subject: [PATCH] CVE-2022-3341 + +--- + libavformat/nutdec.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c +index 979cb9a..886b5c6 100644 +--- a/libavformat/nutdec.c ++++ b/libavformat/nutdec.c +@@ -346,8 +346,12 @@ static int decode_main_header(NUTContext *nut) + ret = AVERROR(ENOMEM); + goto fail; + } +- for (i = 0; i < stream_count; i++) +- avformat_new_stream(s, NULL); ++ for (i = 0; i < stream_count; i++) { ++ if (!avformat_new_stream(s, NULL)) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ } + + return 0; + fail: +@@ -793,19 +797,23 @@ static int nut_read_header(AVFormatContext *s) + NUTContext *nut = s->priv_data; + AVIOContext *bc = s->pb; + int64_t pos; +- int initialized_stream_count; ++ int initialized_stream_count, ret; + + nut->avf = s; + + /* main header */ + pos = 0; ++ ret = 0; + do { ++ if (ret == AVERROR(ENOMEM)) ++ return ret; ++ + pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1; + if (pos < 0 + 1) { + av_log(s, AV_LOG_ERROR, "No main startcode found.\n"); + goto fail; + } +- } while (decode_main_header(nut) < 0); ++ } while ((ret = decode_main_header(nut)) < 0); + + /* stream headers */ + pos = 0; +-- +2.43.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 3ed8f34..f277d8c 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -61,7 +61,7 @@ ExclusiveArch: armv7hnl Summary: Digital VCR and streaming server Name: ffmpeg%{?flavor} Version: 4.2.4 -Release: 8 +Release: 12 License: %{ffmpeg_license} URL: http://ffmpeg.org/ %if 0%{?date} @@ -78,7 +78,11 @@ Patch5: CVE-2020-35964.patch Patch6: CVE-2024-31578.patch Patch7: CVE-2023-51794.patch Patch8: fix-CVE-2023-51798.patch -Patch9: fix-CVE-2023-51793.patch +Patch9: CVE-2022-3341.patch +Patch10: CVE-2022-3109.patch +Patch11: fix-CVE-2023-51793.patch +Patch12: fix-CVE-2023-50010.patch +Patch13: CVE-2021-38171.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{?_with_cuda:BuildRequires: cuda-minimal-build-%{_cuda_version_rpm} cuda-drivers-devel} %{?_with_libnpp:BuildRequires: pkgconfig(nppc-%{_cuda_version})} @@ -411,9 +415,21 @@ install -pm755 tools/qt-faststart %{buildroot}%{_bindir} %changelog -* Thu Jun 27 2024 happyworker <208suo@208suo.com> - 4.2.4-8 +* Tue Jul 2 2024 happyworker <208suo@208suo.com> - 4.2.4-12 +- Fix CVE-2021-38171 + +* Tue Jul 02 2024 happyworker <208suo@208suo.com> - 4.2.4-11 +- Fix CVE-2023-50010 + +* Tue Jul 02 2024 happyworker <208suo@208suo.com> - 4.2.4-10 - Fix CVE-2023-51793 +* Wed Jun 26 2024 happyworker <208suo@208suo.com> - 4.2.4-9 +- Fix CVE-2022-3109 + +* Tue Jun 25 2024 happyworker <208suo@208suo.com> - 4.2.4-8 +- Fix CVE-2022-3341 + * Tue Jun 25 2024 happyworker <208suo@208suo.com> - 4.2.4-7 - Fix CVE-2023-51798 diff --git a/fix-CVE-2023-50010.patch b/fix-CVE-2023-50010.patch new file mode 100644 index 0000000..6953414 --- /dev/null +++ b/fix-CVE-2023-50010.patch @@ -0,0 +1,25 @@ +From fa8e9d837130cde3d0548b01aa9cb42e60e30a24 Mon Sep 17 00:00:00 2001 +From: Michael Niedermayer +Date: Fri, 28 Jun 2024 16:48:40 +0800 +Subject: [PATCH] fix CVE-2023-50010 + +--- + libavfilter/vf_gradfun.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c +index f63128d..da4c01a 100644 +--- a/libavfilter/vf_gradfun.c ++++ b/libavfilter/vf_gradfun.c +@@ -92,7 +92,7 @@ static void filter(GradFunContext *ctx, uint8_t *dst, const uint8_t *src, int wi + for (y = 0; y < r; y++) + ctx->blur_line(dc, buf + y * bstride, buf + (y - 1) * bstride, src + 2 * y * src_linesize, src_linesize, width / 2); + for (;;) { +- if (y < height - r) { ++ if (y + 1 < height - r) { + int mod = ((y + r) / 2) % r; + uint16_t *buf0 = buf + mod * bstride; + uint16_t *buf1 = buf + (mod ? mod - 1 : r - 1) * bstride; +-- +2.43.0 + -- Gitee