fix CVE-2024-36617 CVE-2024-36618

(cherry picked from commit 49d0c89410e4ef74d4c93608d137eea7f9ec9ae3)
This commit is contained in:
liningjie 2024-12-13 17:24:06 +08:00 committed by openeuler-sync-bot
parent 8bf8b2caa1
commit 116e131ddb
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From d973fcbcc2f944752ff10e6a76b0b2d9329937a7 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat, 30 Sep 2023 00:38:17 +0200
Subject: [PATCH] avformat/cafdec: dont seek beyond 64bit
Fixes: signed integer overflow: 64 + 9223372036854775807 cannot be represented in type 'long long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6418242730328064
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6418242730328064
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/cafdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 8622859..f5c62a8 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -209,7 +209,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
}
- if (avio_tell(pb) - ccount > size) {
+ if (avio_tell(pb) - ccount > size || size > INT64_MAX - ccount) {
av_log(s, AV_LOG_ERROR, "error reading packet table\n");
return AVERROR_INVALIDDATA;
}
--
2.43.0

View File

@ -0,0 +1,31 @@
From 7a089ed8e049e3bfcb22de1250b86f2106060857 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 12 Mar 2024 23:23:17 +0100
Subject: [PATCH] avformat/avidec: Fix integer overflow iff ULONG_MAX <
INT64_MAX
Affects many FATE-tests, see
https://fate.ffmpeg.org/report.cgi?time=20240312011016&slot=ppc-linux-gcc-13.2-ubsan-altivec-qemu
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avidec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 59c06ea..81e904d 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1645,7 +1645,7 @@ static int check_stream_max_drift(AVFormatContext *s)
int *idx = av_mallocz_array(s->nb_streams, sizeof(*idx));
if (!idx)
return AVERROR(ENOMEM);
- for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) {
+ for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1ULL) {
int64_t max_dts = INT64_MIN / 2;
int64_t min_dts = INT64_MAX / 2;
int64_t max_buffer = 0;
--
2.43.0

View File

@ -60,7 +60,7 @@
Summary: Digital VCR and streaming server
Name: ffmpeg%{?flavor}
Version: 4.2.4
Release: 20
Release: 21
License: %{ffmpeg_license}
URL: http://ffmpeg.org/
%if 0%{?date}
@ -91,6 +91,8 @@ Patch19: backport-CVE-2024-35366.patch
Patch20: backport-CVE-2024-35367.patch
Patch21: backport-CVE-2024-35368.patch
Patch22: backport-CVE-2024-36616.patch
Patch23: backport-CVE-2024-36618.patch
Patch24: backport-CVE-2024-36617.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%{?_with_cuda:BuildRequires: cuda-minimal-build-%{_cuda_version_rpm} cuda-drivers-devel}
@ -424,6 +426,9 @@ install -pm755 tools/qt-faststart %{buildroot}%{_bindir}
%changelog
* Fri Dec 13 2024 liningjie <liningjie@xfusion.com> - 4.2.4-21
- fix CVE-2024-36617 CVE-2024-36618
* Mon Dec 02 2024 liningjie <liningjie@xfusion.com> - 4.2.4-20
- fix CVE-2024-35368 CVE-2024-36616