aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-15 01:07:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:20 +0100
commitdfa3c6d49f6e585f7285e2c90e5210619f6ea732 (patch)
tree93dcaac045455652d9e224b1860cbe24eafe0c97
parent100a7db0780e62e6ebd0730a8ddff038c0755e6a (diff)
downloadffmpeg-dfa3c6d49f6e585f7285e2c90e5210619f6ea732.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.c5
1 files changed, 4 insertions, 1 deletions
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);
}