ivfdec: tolerate invalid framerates
authorJames Zern <jzern@google.com>
Wed, 1 Jun 2016 00:37:59 +0000 (17:37 -0700)
committerJames Zern <jzern@google.com>
Wed, 1 Jun 2016 00:37:59 +0000 (17:37 -0700)
default invalid framerates to 30, quiets warnings in corrupt / fuzzed
files

Change-Id: Ib10d2b67df83cb6f9ed1cd6ef8e0e637aa7099ff

ivfdec.c

index 6dcd66f..6d1d679 100644 (file)
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -23,7 +23,7 @@ static void fix_framerate(int *num, int *den) {
   // we can guess the framerate using only the timebase in this
   // case. Other files would require reading ahead to guess the
   // timebase, like we do for webm.
-  if (*num < 1000) {
+  if (*den > 0 && *num > 0 && *num < 1000) {
     // Correct for the factor of 2 applied to the timebase in the encoder.
     if (*num & 1)
       *den *= 2;