[FFmpeg-cvslog] r24148 - trunk/tests/tiny_psnr.c

mru subversion
Sat Jul 10 01:26:37 CEST 2010


Author: mru
Date: Sat Jul 10 01:26:36 2010
New Revision: 24148

Log:
tiny_psnr: check fread() return values

Modified:
   trunk/tests/tiny_psnr.c

Modified: trunk/tests/tiny_psnr.c
==============================================================================
--- trunk/tests/tiny_psnr.c	Sat Jul 10 01:26:33 2010	(r24147)
+++ trunk/tests/tiny_psnr.c	Sat Jul 10 01:26:36 2010	(r24148)
@@ -131,14 +131,17 @@ int main(int argc,char* argv[]){
 
     for (i = 0; i < 2; i++) {
         uint8_t *p = buf[i];
-        fread(p, 1, 12, f[i]);
+        if (fread(p, 1, 12, f[i]) != 12)
+            return 1;
         if (!memcmp(p,   "RIFF", 4) &&
             !memcmp(p+8, "WAVE", 4)) {
-            fread(p, 1, 8, f[i]);
+            if (fread(p, 1, 8, f[i]) != 8)
+                return 1;
             while (memcmp(p, "data", 4)) {
                 int s = p[4] | p[5]<<8 | p[6]<<16 | p[7]<<24;
                 fseek(f[i], s, SEEK_CUR);
-                fread(p, 1, 8, f[i]);
+                if (fread(p, 1, 8, f[i]) != 8)
+                    return 1;
             }
         } else {
             fseek(f[i], -12, SEEK_CUR);



More information about the ffmpeg-cvslog mailing list