From 3bf21b1049abf8991beac79235adfcca9d705eda Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sun, 18 Sep 2011 19:16:34 +0200
Subject: [PATCH 07/24] Don't accept mpegts PMT that isn't current

---
 libavformat/mpegts.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index e7e061e..817fbed 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -437,6 +437,7 @@ typedef struct SectionHeader {
     uint8_t tid;
     uint16_t id;
     uint8_t version;
+    uint8_t current;
     uint8_t sec_num;
     uint8_t last_sec_num;
 } SectionHeader;
@@ -508,6 +509,7 @@ static int parse_section_header(SectionHeader *h,
     val = get8(pp, p_end);
     if (val < 0)
         return -1;
+    h->current = val & 0x1;
     h->version = (val >> 1) & 0x1f;
     val = get8(pp, p_end);
     if (val < 0)
@@ -1556,6 +1558,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         return;
     if (h->tid != PAT_TID)
         return;
+    if (!h->current)
+        return;
 
     ts->stream->ts_id = h->id;
 
-- 
1.7.9.4

