mpeg4parser: prevent assertion when scanning for sync code
authorThiago Santos <thiagoss@osg.samsung.com>
Fri, 19 Feb 2016 19:40:54 +0000 (16:40 -0300)
committerThiago Santos <thiagoss@osg.samsung.com>
Fri, 19 Feb 2016 19:42:35 +0000 (16:42 -0300)
Only search if there is indeed enough data to be searched otherwise
an assertion is raised

gst-libs/gst/codecparsers/gstmpeg4parser.c

index ce156c5a28a9cd6240e95df50d43cb126eaa4f00..b23fc872fa54d1eaeeb91b287c9b7b553fb7a14c 100644 (file)
@@ -481,8 +481,11 @@ gst_mpeg4_parse (GstMpeg4Packet * packet, gboolean skip_user_data,
   packet->type = (GstMpeg4StartCode) (data[off1 + 3]);
 
 find_end:
-  off2 = gst_byte_reader_masked_scan_uint32 (&br, 0xffffff00, 0x00000100,
-      off1 + 4, size - off1 - 4);
+  if (off1 < size - 4)
+    off2 = gst_byte_reader_masked_scan_uint32 (&br, 0xffffff00, 0x00000100,
+        off1 + 4, size - off1 - 4);
+  else
+    off2 = -1;
 
   if (off2 == -1) {
     GST_DEBUG ("Packet start %d, No end found", off1 + 4);