tiny_psnr: check for specified sample size less than 1
authorMans Rullgard <mans@mansr.com>
Sun, 14 Oct 2012 23:11:44 +0000 (00:11 +0100)
committerMans Rullgard <mans@mansr.com>
Mon, 15 Oct 2012 20:40:18 +0000 (21:40 +0100)
A zero or negative sample size is impossible and should be
reported as an error.

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

index 5db2662..a53a670 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
         } else {
             char *end;
             len = strtol(argv[3], &end, 0);
-            if (*end || len > 2) {
+            if (*end || len < 1 || len > 2) {
                 fprintf(stderr, "Unsupported sample format: %s\n", argv[3]);
                 return 1;
             }