diff options
author | Måns Rullgård <mans@mansr.com> | 2010-07-09 23:26:36 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2010-07-09 23:26:36 +0000 |
commit | cd3cb048d995c522cfd892d0603e1e0e96bcab6d (patch) | |
tree | 57484a358114d59255f8263bb6d2356b6c604488 /tests | |
parent | 58d2b1544720cba8100ed0148edb73147f08b3e8 (diff) | |
download | ffmpeg-cd3cb048d995c522cfd892d0603e1e0e96bcab6d.tar.gz |
tiny_psnr: check fread() return values
Originally committed as revision 24148 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tiny_psnr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c index 4a8ba42ad7..047048013a 100644 --- a/tests/tiny_psnr.c +++ b/tests/tiny_psnr.c @@ -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); |