diff mbox series

[FFmpeg-devel,09/22] avformat/mp3dec: Check header_filesize

Message ID 20240711233417.1896879-9-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/22] avformat/asfdec_o: Check size of index object | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 11, 2024, 11:34 p.m. UTC
Fixes: CID1608714 Division or modulo by float zero

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mp3dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 6443b80596c..0029ba63aa3 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -585,7 +585,7 @@  static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
     if (best_pos < 0)
         return best_pos;
 
-    if (mp3->is_cbr && ie == &ie1 && mp3->frames) {
+    if (mp3->is_cbr && ie == &ie1 && mp3->frames && mp3->header_filesize > 0) {
         int frame_duration = av_rescale(st->duration, 1, mp3->frames);
         ie1.timestamp = frame_duration * av_rescale(best_pos - si->data_offset, mp3->frames, mp3->header_filesize);
     }