/*
- * MPEG2 transport stream (aka DVB) demuxer
+ * MPEG-2 transport stream (aka DVB) demuxer
* Copyright (c) 2002-2003 Fabrice Bellard
*
* This file is part of FFmpeg.
#include "mpeg.h"
#include "isom.h"
-/* maximum size in which we look for synchronisation if
- * synchronisation is lost */
+/* maximum size in which we look for synchronization if
+ * synchronization is lost */
#define MAX_RESYNC_SIZE 65536
#define MAX_PES_PAYLOAD 200 * 1024
{ 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM }, /* LATM syntax */
#endif
{ 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
+ { 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC },
{ 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
{ 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 },
{ 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
* decide */
if (pes->header[0] == 0x00 && pes->header[1] == 0x00 &&
pes->header[2] == 0x01) {
- /* it must be an mpeg2 PES stream */
+ /* it must be an MPEG-2 PES stream */
code = pes->header[3] | 0x100;
av_log(pes->stream, AV_LOG_TRACE, "pid=%x pes_code=%#x\n", pes->pid,
code);
if (!descr)
return AVERROR_INVALIDDATA;
+#define R8_CHECK_CLIP_MAX(dst, maxv) do { \
+ descr->sl.dst = avio_r8(&d->pb); \
+ if (descr->sl.dst > maxv) { \
+ descr->sl.dst = maxv; \
+ return AVERROR_INVALIDDATA; \
+ } \
+} while (0)
+
predefined = avio_r8(&d->pb);
if (!predefined) {
int lengths;
descr->sl.use_idle = !!(flags & 0x02);
descr->sl.timestamp_res = avio_rb32(&d->pb);
avio_rb32(&d->pb);
- descr->sl.timestamp_len = avio_r8(&d->pb);
- if (descr->sl.timestamp_len > 64) {
- avpriv_request_sample(NULL, "timestamp_len > 64");
- descr->sl.timestamp_len = 64;
- return AVERROR_PATCHWELCOME;
- }
- descr->sl.ocr_len = avio_r8(&d->pb);
- descr->sl.au_len = avio_r8(&d->pb);
+ R8_CHECK_CLIP_MAX(timestamp_len, 63);
+ R8_CHECK_CLIP_MAX(ocr_len, 63);
+ R8_CHECK_CLIP_MAX(au_len, 31);
descr->sl.inst_bitrate_len = avio_r8(&d->pb);
lengths = avio_rb16(&d->pb);
descr->sl.degr_prior_len = lengths >> 12;