nutdec: check that filesize is valid before using it.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 30 Jun 2012 15:01:59 +0000 (17:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 30 Jun 2012 15:22:37 +0000 (17:22 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/nutdec.c

index cd0dd94..d19127c 100644 (file)
@@ -562,6 +562,9 @@ static int find_and_decode_index(NUTContext *nut)
     int8_t *has_keyframe;
     int ret = -1;
 
+    if(filesize <= 0)
+        return -1;
+
     avio_seek(bc, filesize - 12, SEEK_SET);
     avio_seek(bc, filesize - avio_rb64(bc), SEEK_SET);
     if (avio_rb64(bc) != INDEX_STARTCODE) {