[FFmpeg-cvslog] avformat/mpeg: Check avio_read() return value in get_pts()

Michael Niedermayer git at videolan.org
Tue Aug 18 15:56:25 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Aug 15 01:07:44 2020 +0200| [e8a88a16f78e66c8d7645b5f71dc8390b033fa70] | committer: Michael Niedermayer

avformat/mpeg: Check avio_read() return value in get_pts()

Found-by: Thierry Foucu <tfoucu at gmail.com>
Fixes: Use-of-uninitialized-value
Reviewed-by: Thierry Foucu <tfoucu at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mpeg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 265b2bd1ad..a5e17925ce 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -147,9 +147,12 @@ static int mpegps_read_header(AVFormatContext *s)
 static int64_t get_pts(AVIOContext *pb, int c)
 {
     uint8_t buf[5];
+    int ret;
 
     buf[0] = c < 0 ? avio_r8(pb) : c;
-    avio_read(pb, buf + 1, 4);
+    ret = avio_read(pb, buf + 1, 4);
+    if (ret < 4)
+        return AV_NOPTS_VALUE;
 
     return ff_parse_pes_pts(buf);
 }



More information about the ffmpeg-cvslog mailing list