diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3f06c57444..71a4549c3b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1459,8 +1459,12 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } break; case 0x1F: /* FMC descriptor */ - get16(pp, desc_end); - if (mp4_descr_count > 0 && (st->codec->codec_id == AV_CODEC_ID_AAC_LATM || st->request_probe>0) && + if (get16(pp, desc_end) < 0) + break; + if (mp4_descr_count > 0 && + (st->codec->codec_id == AV_CODEC_ID_AAC_LATM || + (st->request_probe == 0 && st->codec->codec_id == AV_CODEC_ID_NONE) || + st->request_probe > 0) && mp4_descr->dec_config_descr_len && mp4_descr->es_id == pid) { AVIOContext pb; ffio_init_context(&pb, mp4_descr->dec_config_descr,