diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-08-15 01:07:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-05 21:28:08 +0200 |
commit | cb667b646009a071f3fe17eaa7fdf988ebfd15b1 (patch) | |
tree | 512616758901ed2651a9ebba599b98f708d5009c | |
parent | 8ae6def1e033261b65d73a3d48f6bb9ffa6647ba (diff) | |
download | ffmpeg-cb667b646009a071f3fe17eaa7fdf988ebfd15b1.tar.gz |
avformat/mpeg: Check avio_read() return value in get_pts()
Found-by: Thierry Foucu <tfoucu@gmail.com>
Fixes: Use-of-uninitialized-value
Reviewed-by: Thierry Foucu <tfoucu@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e8a88a16f78e66c8d7645b5f71dc8390b033fa70)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mpeg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index ff85ad54ee..3549752bc4 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -161,9 +161,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); } |