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/3] avformat/lafdec: Check for EOF in header reading
@ 2022-11-12 23:43 Michael Niedermayer
  2022-11-12 23:44 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mjpegbdec: Check for AVDISCARD_ALL Michael Niedermayer
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Michael Niedermayer @ 2022-11-12 23:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: OOM testcase
Fixes: 51527/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-5453663505612800

OOM can still happen after this as an arbitrary sized block is allocated and read
this would require a redesign or some limit on the sample rate.

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

diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c
index 12b0d8540b..d02b479c4d 100644
--- a/libavformat/lafdec.c
+++ b/libavformat/lafdec.c
@@ -111,6 +111,9 @@ static int laf_read_header(AVFormatContext *ctx)
     sample_rate = avio_rl32(pb);
     duration = avio_rl64(pb) / st_count;
 
+    if (avio_feof(pb))
+        return AVERROR_INVALIDDATA;
+
     switch (quality) {
     case 0:
         codec_id = AV_CODEC_ID_PCM_U8;
-- 
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] 10+ messages in thread

end of thread, other threads:[~2022-12-23 21:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12 23:43 [FFmpeg-devel] [PATCH 1/3] avformat/lafdec: Check for EOF in header reading Michael Niedermayer
2022-11-12 23:44 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mjpegbdec: Check for AVDISCARD_ALL Michael Niedermayer
2022-12-22 23:27   ` Michael Niedermayer
2022-12-23 18:39   ` James Almer
2022-11-12 23:44 ` [FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: Reduce overflows in essence_length computation Michael Niedermayer
2022-11-16 11:49   ` Tomas Härdin
2022-12-22 23:25     ` Michael Niedermayer
2022-12-23 11:47       ` Tomas Härdin
2022-12-23 21:22         ` Michael Niedermayer
2022-12-22 23:27 ` [FFmpeg-devel] [PATCH 1/3] avformat/lafdec: Check for EOF in header reading 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