mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
Add buffer length checks to every typefinding function
Original commit message from CVS: Add buffer length checks to every typefinding function
This commit is contained in:
parent
7bea2b377a
commit
322baf19c8
4 changed files with 17 additions and 2 deletions
|
@ -161,9 +161,14 @@ GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
|
|||
static GstCaps*
|
||||
dv_type_find (GstBuffer *buf, gpointer private)
|
||||
{
|
||||
guint32 head = GUINT32_FROM_BE(*((guint32 *)GST_BUFFER_DATA(buf)));
|
||||
guint32 head;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 5)
|
||||
return NULL;
|
||||
|
||||
head = GUINT32_FROM_BE(*((guint32 *)GST_BUFFER_DATA(buf)));
|
||||
|
||||
/* check for DIF and DV flag */
|
||||
if ((head & 0xffffff00) == 0x1f070000 && !(GST_BUFFER_DATA(buf)[4] & 0x01)) {
|
||||
gchar *format;
|
||||
|
|
|
@ -71,8 +71,12 @@ static GstTypeDefinition flacdefinition = {
|
|||
static GstCaps*
|
||||
flac_type_find (GstBuffer *buf, gpointer private)
|
||||
{
|
||||
guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf)));
|
||||
guint32 head;
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 4)
|
||||
return NULL;
|
||||
|
||||
head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf)));
|
||||
if (head != 0x664C6143)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ au_type_find (GstBuffer *buf, gpointer private)
|
|||
GstCaps *new = NULL;
|
||||
gulong *head = (gulong *) GST_BUFFER_DATA (buf);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 4)
|
||||
return NULL;
|
||||
|
||||
if (*head == 0x2e736e64 || *head == 0x646e732e)
|
||||
new = gst_caps_new ("au_type_find", "audio/au", NULL);
|
||||
|
||||
|
|
|
@ -181,6 +181,9 @@ avi_type_find (GstBuffer *buf,
|
|||
|
||||
GST_DEBUG ("avi_demux: typefind");
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 12)
|
||||
return NULL;
|
||||
|
||||
if (GUINT32_FROM_LE (((guint32 *)data)[0]) != GST_RIFF_TAG_RIFF)
|
||||
return NULL;
|
||||
if (GUINT32_FROM_LE (((guint32 *)data)[2]) != GST_RIFF_RIFF_AVI)
|
||||
|
|
Loading…
Reference in a new issue