[FFmpeg-cvslog] avformat/cafdec: dont seek beyond 64bit

Michael Niedermayer git at videolan.org
Sun Apr 14 21:33:14 EEST 2024


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Sep 30 00:38:17 2023 +0200| [625ca605f5b1f60f6409949533bcff8982d61464] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit d973fcbcc2f944752ff10e6a76b0b2d9329937a7)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=625ca605f5b1f60f6409949533bcff8982d61464
---

 libavformat/cafdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 1842c3c0ae..296e07c085 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -220,7 +220,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
         }
     }
 
-    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;
     }



More information about the ffmpeg-cvslog mailing list