diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index dbbaa9e..f964190 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -1183,6 +1183,12 @@ gst_mpegts_section_new (guint16 pid, guint8 * data, gsize data_size)
 
   /* Check for length */
   section_length = GST_READ_UINT16_BE (data + 1) & 0x0FFF;
+  if (section_length < 5) {
+    GST_WARNING
+        ("PID 0x%04x section length invalid", pid);
+    g_free (data);
+    return NULL;
+  }
   if (G_UNLIKELY (data_size < section_length + 3))
     goto short_packet;
 
