diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-22 01:18:38 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-22 19:23:12 +0200 |
commit | 178eebd79e5bf3f4a4471576cd1a48bf9df59e09 (patch) | |
tree | e3f766f1e8c81fb58de459c5aafcb9b30311cd8e | |
parent | f5495c970cf2a8745a2f4520d543cb215c06e545 (diff) | |
download | ffmpeg-178eebd79e5bf3f4a4471576cd1a48bf9df59e09.tar.gz |
mpegts: handle AVMEDIA_TYPE_UNKNOWN correctly
It is negative, so can't be used for left shifting.
This fixes ubsan runtime error: shift exponent -1 is negative
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavformat/mpegts.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 97a22251aa..cc2addcc9e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2353,7 +2353,8 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) int types = 0; for (i = 0; i < ts->stream->nb_streams; i++) { AVStream *st = ts->stream->streams[i]; - types |= 1<<st->codecpar->codec_type; + if (st->codecpar->codec_type >= 0) + types |= 1<<st->codecpar->codec_type; } if ((types & (1<<AVMEDIA_TYPE_AUDIO) && types & (1<<AVMEDIA_TYPE_VIDEO)) || pos > 100000) { av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n"); |