summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2016-02-19 16:40:54 -0300
committerTim-Philipp Müller <tim@centricular.com>2016-04-06 14:15:43 +0100
commitef6839e72c62ed0cd41f3da276414268167f21c9 (patch)
treec987dd6c58832129533e9c0d36e8aa67a3521609
parent2df0ea3ab9c259533a83c66cabf0128b226f93d1 (diff)
mpeg4parser: prevent assertion when scanning for sync code
Only search if there is indeed enough data to be searched otherwise an assertion is raised
-rw-r--r--gst-libs/gst/codecparsers/gstmpeg4parser.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gst-libs/gst/codecparsers/gstmpeg4parser.c b/gst-libs/gst/codecparsers/gstmpeg4parser.c
index ce156c5a2..b23fc872f 100644
--- a/gst-libs/gst/codecparsers/gstmpeg4parser.c
+++ b/gst-libs/gst/codecparsers/gstmpeg4parser.c
@@ -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);