omadec: fix len check in nprobe() prevent out of array access
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 11 Nov 2012 17:16:24 +0000 (18:16 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 11 Nov 2012 17:16:48 +0000 (18:16 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/omadec.c

index 1e1b980..5f7669a 100644 (file)
@@ -159,7 +159,7 @@ static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size, const uint8
     taglen = AV_RB32(&enc_header[pos+32]);
     datalen = AV_RB32(&enc_header[pos+36]) >> 4;
 
     taglen = AV_RB32(&enc_header[pos+32]);
     datalen = AV_RB32(&enc_header[pos+36]) >> 4;
 
-    if(taglen + (((uint64_t)datalen)<<4) + 44 > size)
+    if(pos + (uint64_t)taglen + (((uint64_t)datalen)<<4) + 44 > size)
         return -1;
 
     pos += 44 + taglen;
         return -1;
 
     pos += 44 + taglen;