[PATCH] avformat/mtv: validate computed frame rate

albab-hasan via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
the frame rate is derived from audio_br and audio_subsegments via integer
division. if audio_br is small enough that the result truncates to zero,
avpriv_set_pts_info() silently ignores the call, leaving the video stream
with an invalid timebase.
---
 libavformat/mtv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index c888443b7a..10be0faf7e 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -155,8 +155,10 @@ static int mtv_read_header(AVFormatContext *s)
         audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
         mtv->img_segment_size;
     mtv->video_fps         = (mtv->audio_br / 4) / audio_subsegments;
-
-    // FIXME Add sanity check here
+    if (!mtv->video_fps) {
+        av_log(s, AV_LOG_ERROR, "Invalid frame rate\n");
+        return AVERROR_INVALIDDATA;
+    }
 
     // all systems go! init decoders
 
-- 
2.43.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.