]> git.sesse.net Git - ffmpeg/commitdiff
tiny_psnr: fix range calculation for sample size of 32 bits
authorMans Rullgard <mans@mansr.com>
Sun, 14 Oct 2012 23:21:53 +0000 (00:21 +0100)
committerMans Rullgard <mans@mansr.com>
Mon, 15 Oct 2012 20:41:25 +0000 (21:41 +0100)
For a sample size of 32 bits, the shift would overflow producing
undefined results.  Incidentally, in the only test currently using
32-bit samples, the output matches the reference exactly on most
systems meaning the bad 'max' value is never used.

Signed-off-by: Mans Rullgard <mans@mansr.com>
tests/tiny_psnr.c

index a53a67038bcefa0d584eefdaca9e5101804d8ed8..b1bcc166937b99b82b88bd0e8c0ddc223e0f5f6d 100644 (file)
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
         }
     }
 
-    max = (1 << (8 * len)) - 1;
+    max = (1LL << (8 * len)) - 1;
 
     f[0] = fopen(argv[1], "rb");
     f[1] = fopen(argv[2], "rb");