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/kvag: Check sample_rate
@ 2024-04-30  0:48 Michael Niedermayer
  2024-04-30  0:48 ` [FFmpeg-devel] [PATCH 2/3] avformat/concatdec: Check file Michael Niedermayer
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michael Niedermayer @ 2024-04-30  0:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Division by 0
Fixes: -copyts -start_at_zero -itsoffset 00:00:01 -itsscale 1 -ss 00:00:02  -i zgclab/ffmpeg_crash/poc1 output.mp4

Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/kvag.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/kvag.c b/libavformat/kvag.c
index 1d0aee09942..b55aa893ec2 100644
--- a/libavformat/kvag.c
+++ b/libavformat/kvag.c
@@ -38,7 +38,7 @@
 typedef struct KVAGHeader {
     uint32_t    magic;
     uint32_t    data_size;
-    uint32_t    sample_rate;
+    int    sample_rate;
     uint16_t    stereo;
 } KVAGHeader;
 
@@ -70,6 +70,9 @@ static int kvag_read_header(AVFormatContext *s)
     hdr.sample_rate             = AV_RL32(buf +  8);
     hdr.stereo                  = AV_RL16(buf + 12);
 
+    if (hdr.sample_rate <= 0)
+        return AVERROR_INVALIDDATA;
+
     par                         = st->codecpar;
     par->codec_type             = AVMEDIA_TYPE_AUDIO;
     par->codec_id               = AV_CODEC_ID_ADPCM_IMA_SSI;
-- 
2.43.2

_______________________________________________
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] 9+ messages in thread

end of thread, other threads:[~2024-05-09  1:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30  0:48 [FFmpeg-devel] [PATCH 1/3] avformat/kvag: Check sample_rate Michael Niedermayer
2024-04-30  0:48 ` [FFmpeg-devel] [PATCH 2/3] avformat/concatdec: Check file Michael Niedermayer
2024-05-09  1:03   ` Michael Niedermayer
2024-04-30  0:48 ` [FFmpeg-devel] [PATCH 3/3] avutil/opt: Preserve nb_channels in opt_free Michael Niedermayer
2024-04-30 21:27   ` James Almer
2024-05-01  0:38     ` Michael Niedermayer
2024-05-01  0:41       ` James Almer
2024-05-01 14:54       ` James Almer
2024-04-30 21:12 ` [FFmpeg-devel] [PATCH 1/3] avformat/kvag: Check sample_rate 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