[FFmpeg-cvslog] avformat/mp3dec; Check for avio_size() failure

Michael Niedermayer git at videolan.org
Sun Jan 5 01:28:55 EET 2025


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jul 11 20:17:00 2024 +0200| [99b01e80b4e555eabf7b64aa22895231d893db2b] | committer: Michael Niedermayer

avformat/mp3dec; Check for avio_size() failure

Fixes: CID1608710 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit bb936a1a720856a51c48bf907475daa8065920c9)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99b01e80b4e555eabf7b64aa22895231d893db2b
---

 libavformat/mp3dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 42f97db4d4..8669f685e3 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -118,9 +118,10 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
     int fill_index = mp3->usetoc == 1 && duration > 0;
 
     if (!filesize &&
-        !(filesize = avio_size(s->pb))) {
+        (filesize = avio_size(s->pb)) <= 0) {
         av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
         fill_index = 0;
+        filesize = 0;
     }
 
     for (i = 0; i < XING_TOC_COUNT; i++) {



More information about the ffmpeg-cvslog mailing list