]> granicus.if.org Git - libvpx/commitdiff
vpxdec: report parse errors from webm_guess_framerate()
authorJohn Koleszar <jkoleszar@google.com>
Thu, 4 Nov 2010 18:54:51 +0000 (14:54 -0400)
committerJohn Koleszar <jkoleszar@google.com>
Thu, 4 Nov 2010 18:56:48 +0000 (14:56 -0400)
If this function fails silently, the nestegg context is destroyed and
future nestegg calls will segfault.

Change-Id: Ie6a0ea284ab9ddfa97b1843ef8030a953937c8cd

vpxdec.c

index 85ab2069334c0ebde88a2cb4986ffa5c91c44633..9b565b0223a42a32d6c79bdb54904f0477025cd9 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -542,6 +542,7 @@ webm_guess_framerate(struct input_ctx *input,
     *fps_den = tstamp / 1000;
     return 0;
 fail:
+    nestegg_destroy(input->nestegg_ctx);
     input->nestegg_ctx = NULL;
     rewind(input->infile);
     return 1;
@@ -878,7 +879,13 @@ int main(int argc, const char **argv_)
         }
 
         if(input.kind == WEBM_FILE)
-            webm_guess_framerate(&input, &fps_den, &fps_num);
+            if(webm_guess_framerate(&input, &fps_den, &fps_num))
+            {
+                fprintf(stderr, "Failed to guess framerate -- error parsing "
+                                "webm file?\n");
+                return EXIT_FAILURE;
+            }
+
 
         /*Note: We can't output an aspect ratio here because IVF doesn't
            store one, and neither does VP8.