Browse Source

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 e8a88a16f7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.3.2
Michael Niedermayer 5 years ago
parent
commit
dfa3c6d49f
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavformat/mpeg.c

+ 4
- 1
libavformat/mpeg.c View File

@@ -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);
}


Loading…
Cancel
Save