diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-08-15 01:07:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:19 +0200 |
commit | df401e11ed76d8fa60e77d4c8a6984f1b181b859 (patch) | |
tree | 8eccfecf21f2f38c7c3ceb54912b4574965b39ec | |
parent | a590a733fa97a95aecb060231f34fafcb63e553c (diff) | |
download | ffmpeg-df401e11ed76d8fa60e77d4c8a6984f1b181b859.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 69fb759d36..fe797f559c 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -159,9 +159,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); } |