diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-13 15:21:41 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-13 15:44:13 +0100 |
commit | 327cd0d09b459bcc9996cd864bf8569788d70b5b (patch) | |
tree | eecd5bf70c6a59562d738a44d78cb95603667e4f /libavformat/mpegts.c | |
parent | 09a0392341ac0bfc969f0ff9e103671b3c64713e (diff) | |
download | ffmpeg-327cd0d09b459bcc9996cd864bf8569788d70b5b.tar.gz |
mpegts: prevent freeing ones own section in pmt_cb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r-- | libavformat/mpegts.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 5b04b63da6..b4380a6ea9 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -127,6 +127,7 @@ struct MpegTSContext { /** filters for various streams specified by PMT + for the PAT and PMT */ MpegTSFilter *pids[NB_PID_MAX]; + int current_pid; }; static const AVOption options[] = { @@ -1493,6 +1494,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (pid < 0) break; pid &= 0x1fff; + if (pid == ts->current_pid) + break; /* now create stream */ if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { @@ -1701,6 +1704,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) } if (!tss) return 0; + ts->current_pid = pid; afc = (packet[3] >> 4) & 3; if (afc == 0) /* reserved value */ |