int file_format, format_version;
gchar *type;
- g_print("calling gst_aftypes_type_find\n");
+ GST_DEBUG("calling gst_aftypes_type_find");
buffer_wrap->buffer = buf;
buffer_wrap->offset = 0;
file_format = afGetFileFormat (file, &format_version);
afCloseFile (file);
- g_print("file format: %d\n", file_format);
+ GST_DEBUG("file format: %d", file_format);
/* reject raw data, just in case it is some other format */
if (file_format == AF_FILE_UNKNOWN ||
static GstCaps*
vorbis_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 != 0x4F676753)
return NULL;
{
gchar *data = GST_BUFFER_DATA(buf);
+ if (GST_BUFFER_SIZE (buf) < 4)
+ return NULL;
+
if((data[0] != 'F' && data[0] != 'C') ||
data[1] != 'W' || data[2] != 'S')return NULL;
static GstCaps*
tarkin_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;
/* FIXME */
return NULL;
+ head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf)));
+
if (head != 0x4F676753)
return NULL;
GST_DEBUG ("cdxa_parse: 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_CDXA)
gchar *data = GST_BUFFER_DATA (buf);
gint i;
+ /* 20 is arbitrary. 4 is definitely too small. */
+ if (GST_BUFFER_SIZE (buf) < 20)
+ return NULL;
+
for (i=0; i<GST_BUFFER_SIZE (buf); i++) {
- if (!isprint(*(data+i)))
+ if (!isprint(data[i]) && data[i]!='\n')
return NULL;
}
static GstCaps*
modplug_type_find (GstBuffer *buf, gpointer priv)
{
+ if (GST_BUFFER_SIZE (buf) < 75)
+ return NULL;
+
if (MOD_CheckType (buf) ||
Mod_669_CheckType (buf) ||
Amf_CheckType (buf) ||