From e658752c3cb397dd64a2aea9329c33c4f44db25d Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Fri, 31 Jan 2003 01:02:43 +0000 Subject: Applied patch 13968 plus a GST_DEBUG update, part of bug 104854. Original commit message from CVS: Applied patch 13968 plus a GST_DEBUG update, part of bug 104854. --- gst/mpegaudioparse/gstmp3types.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gst/mpegaudioparse/gstmp3types.c b/gst/mpegaudioparse/gstmp3types.c index 43c82b69..ef0e4c05 100644 --- a/gst/mpegaudioparse/gstmp3types.c +++ b/gst/mpegaudioparse/gstmp3types.c @@ -33,13 +33,13 @@ mp3_type_find(GstBuffer *buf, gpointer private) { guint8 *data; gint size; - gulong head; + guint32 head; GstCaps *caps; data = GST_BUFFER_DATA (buf); size = GST_BUFFER_SIZE (buf); - GST_DEBUG (0,"mp3typefind: typefind"); + GST_DEBUG (0,"mp3typefind: typefinding on buffer of size %d", size); /* gracefully ripped from libid3 */ if (size >= 3 && @@ -78,8 +78,13 @@ mp3_type_find(GstBuffer *buf, gpointer private) goto done; } } + + /* make sure there is enough of a buffer to check without running over */ + if (size < 4) + return NULL; + /* now with the right postion, do typefinding */ - head = GULONG_FROM_BE(*((gulong *)data)); + head = GUINT32_FROM_BE(*((gulong *)data)); if ((head & 0xffe00000) != 0xffe00000) return NULL; if (!((head >> 17) & 3)) -- cgit v1.2.1