aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-15 01:07:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:20 +0200
commitf13fb1cfb8e1d367224f8ab6a99cde05285af849 (patch)
treee1785ab89433151b2b0c7d23d6bb2ccb48fbce65 /libavformat
parentb0fd8d6b1523f4f89f20e3a34ffa6a39156a2d56 (diff)
downloadffmpeg-f13fb1cfb8e1d367224f8ab6a99cde05285af849.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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpeg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 7d523e5fc2..8d5f22790e 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);
}