Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/6] avformat/mov: Check samplesize and offset to avoid integer overflow
@ 2023-02-20 19:29 Michael Niedermayer
  2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 2/6] avformat/rka: Fix 1/0 with bps=1 Michael Niedermayer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Michael Niedermayer @ 2023-02-20 19:29 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: signed integer overflow: 9223372036854775584 + 536870912 cannot be represented in type 'long'
Fixes: 55844/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-510613920664780

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6ab43b00c6..8af564ed61 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4192,6 +4192,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                 if (keyframe)
                     distance = 0;
                 sample_size = sc->stsz_sample_size > 0 ? sc->stsz_sample_size : sc->sample_sizes[current_sample];
+                if (current_offset > INT64_MAX - sample_size) {
+                    av_log(mov->fc, AV_LOG_ERROR, "Current offset %"PRId64" or sample size %u is too large\n",
+                           current_offset,
+                           sample_size);
+                    return;
+                }
+
                 if (sc->pseudo_stream_id == -1 ||
                    sc->stsc_data[stsc_index].id - 1 == sc->pseudo_stream_id) {
                     AVIndexEntry *e;
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-23 22:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 19:29 [FFmpeg-devel] [PATCH 1/6] avformat/mov: Check samplesize and offset to avoid integer overflow Michael Niedermayer
2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 2/6] avformat/rka: Fix 1/0 with bps=1 Michael Niedermayer
2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 3/6] avcodec/rka: Fix some integer anomalies Michael Niedermayer
2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 4/6] avcodec/rka: check for size 1 filter Michael Niedermayer
2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 5/6] avcodec/rka: avoid negative value shift Michael Niedermayer
2023-02-20 19:29 ` [FFmpeg-devel] [PATCH 6/6] avcodec/rka: avoid undefined doubling sum overflow Michael Niedermayer
2023-02-23 22:14 ` [FFmpeg-devel] [PATCH 1/6] avformat/mov: Check samplesize and offset to avoid integer overflow Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git