summaryrefslogtreecommitdiff
path: root/gst-libs/gst/mpegts
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2016-11-26 10:23:01 +0100
committerEdward Hervey <bilboed@bilboed.com>2016-11-26 10:45:52 +0100
commit7b12593cceaa0726d7fc370a7556a8e773ccf318 (patch)
treee0fb74f85b55895d631b8510871bfee8ab85b631 /gst-libs/gst/mpegts
parent9053a01e723e07607f0f39ac7d7b58322cb0568d (diff)
downloadgstreamer-plugins-bad-7b12593cceaa0726d7fc370a7556a8e773ccf318.tar.gz
mpegtssection: Fix PAT parsing
Use the estimated number of programs for parsing. Avoids over-reading. https://bugzilla.gnome.org/show_bug.cgi?id=775120
Diffstat (limited to 'gst-libs/gst/mpegts')
-rw-r--r--gst-libs/gst/mpegts/gstmpegtssection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index dbbaa9e50..cb9e3c5e7 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -414,7 +414,7 @@ static gpointer
_parse_pat (GstMpegtsSection * section)
{
GPtrArray *pat;
- guint16 i = 0, nb_programs;
+ guint16 i, nb_programs;
GstMpegtsPatProgram *program;
guint8 *data, *end;
@@ -430,7 +430,9 @@ _parse_pat (GstMpegtsSection * section)
g_ptr_array_new_full (nb_programs,
(GDestroyNotify) _mpegts_pat_program_free);
- while (data < end - 4) {
+ GST_LOG ("nb_programs %u", nb_programs);
+
+ for (i = 0; i < nb_programs; i++) {
program = g_slice_new0 (GstMpegtsPatProgram);
program->program_number = GST_READ_UINT16_BE (data);
data += 2;
@@ -439,8 +441,6 @@ _parse_pat (GstMpegtsSection * section)
data += 2;
g_ptr_array_index (pat, i) = program;
-
- i++;
}
pat->len = nb_programs;