From a962c0f40c1bf71b44a67f898a35122f158b6b25 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 24 Jul 2003 08:49:43 +0000 Subject: Add buffer length checks to every typefinding function Original commit message from CVS: Add buffer length checks to every typefinding function --- ext/ivorbis/vorbis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/ivorbis') diff --git a/ext/ivorbis/vorbis.c b/ext/ivorbis/vorbis.c index 4a95c14e..65ef4b06 100644 --- a/ext/ivorbis/vorbis.c +++ b/ext/ivorbis/vorbis.c @@ -83,7 +83,12 @@ static GstTypeDefinition vorbisdefinition = { 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; -- cgit v1.2.1