mpegts: fix sdt length check
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 9 Apr 2014 14:54:18 +0000 (15:54 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 9 Apr 2014 15:01:43 +0000 (16:01 +0100)
It was originally test for 9 bytes (as the comment says) and was
rewritten buggily. So rewrite it a third way, which is now
hopefully consistent with the original and the comment, while
being more sense-making to humans.

Coverity 1139654

gst-libs/gst/mpegts/gst-dvb-section.c

index 1feab26..ad2b3fb 100644 (file)
@@ -857,7 +857,7 @@ _parse_sdt (GstMpegTsSection * section)
 
     entry_begin = data;
 
-    if (sdt_info_length + 5 < 4) {
+    if (sdt_info_length - 4 < 5) {
       /* each entry must be at least 5 bytes (+4 bytes for the CRC) */
       GST_WARNING ("PID %d invalid SDT entry size %d",
           section->pid, sdt_info_length);