changeset 4292:0e275ee37217 libavformat

Check buffer is inside what is passed when probing for flac.
author benoit
date Tue, 27 Jan 2009 18:00:40 +0000
parents f49e5d92ab26
children 491a0b1d4f62
files raw.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Tue Jan 27 12:23:16 2009 +0000
+++ b/raw.c	Tue Jan 27 18:00:40 2009 +0000
@@ -586,11 +586,12 @@
 static int flac_probe(AVProbeData *p)
 {
     uint8_t *bufptr = p->buf;
+    uint8_t *end    = p->buf + p->buf_size;
 
     if(ff_id3v2_match(bufptr))
         bufptr += ff_id3v2_tag_len(bufptr);
 
-    if(memcmp(bufptr, "fLaC", 4)) return 0;
+    if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
     else                          return AVPROBE_SCORE_MAX / 2;
 }
 #endif