Blame SOURCES/0003-mpegtssection-Fix-PAT-parsing.patch

a729fc
From 83f33f4b70657b34acd75317314eb0d63a0c35bd Mon Sep 17 00:00:00 2001
a729fc
From: Edward Hervey <edward@centricular.com>
a729fc
Date: Sat, 26 Nov 2016 10:23:01 +0100
a729fc
Subject: [PATCH 3/4] mpegtssection: Fix PAT parsing
a729fc
a729fc
Use the estimated number of programs for parsing. Avoids over-reading.
a729fc
a729fc
https://bugzilla.gnome.org/show_bug.cgi?id=775120
a729fc
---
a729fc
 gst-libs/gst/mpegts/gstmpegtssection.c | 8 ++++----
a729fc
 1 file changed, 4 insertions(+), 4 deletions(-)
a729fc
a729fc
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
a729fc
index 527ff38..62a1f56 100644
a729fc
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
a729fc
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
a729fc
@@ -414,7 +414,7 @@ static gpointer
a729fc
 _parse_pat (GstMpegtsSection * section)
a729fc
 {
a729fc
   GPtrArray *pat;
a729fc
-  guint16 i = 0, nb_programs;
a729fc
+  guint16 i, nb_programs;
a729fc
   GstMpegtsPatProgram *program;
a729fc
   guint8 *data, *end;
a729fc
 
a729fc
@@ -430,7 +430,9 @@ _parse_pat (GstMpegtsSection * section)
a729fc
       g_ptr_array_new_full (nb_programs,
a729fc
       (GDestroyNotify) _mpegts_pat_program_free);
a729fc
 
a729fc
-  while (data < end - 4) {
a729fc
+  GST_LOG ("nb_programs %u", nb_programs);
a729fc
+
a729fc
+  for (i = 0; i < nb_programs; i++) {
a729fc
     program = g_slice_new0 (GstMpegtsPatProgram);
a729fc
     program->program_number = GST_READ_UINT16_BE (data);
a729fc
     data += 2;
a729fc
@@ -439,8 +441,6 @@ _parse_pat (GstMpegtsSection * section)
a729fc
     data += 2;
a729fc
 
a729fc
     g_ptr_array_index (pat, i) = program;
a729fc
-
a729fc
-    i++;
a729fc
   }
a729fc
   pat->len = nb_programs;
a729fc
 
a729fc
-- 
a729fc
2.9.3
a729fc