video4linux2: Avoid a floating point exception
authorBernhard Übelacker <bernhardu@vr-web.de>
Sun, 27 Jul 2014 15:38:59 +0000 (08:38 -0700)
committerDiego Biurrun <diego@biurrun.de>
Wed, 30 Jul 2014 17:12:17 +0000 (10:12 -0700)
This avoids a segfault in avconv_opt.c:opt_target when trying to
determine the norm.

(cherry picked from commit dc71f1958846bb1d96de43a4603983dc8450cfcc)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
avconv_opt.c

index d62d11f..73d283a 100644 (file)
@@ -1726,7 +1726,8 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
             for (j = 0; j < nb_input_files; j++) {
                 for (i = 0; i < input_files[j]->nb_streams; i++) {
                     AVCodecContext *c = input_files[j]->ctx->streams[i]->codec;
-                    if (c->codec_type != AVMEDIA_TYPE_VIDEO)
+                    if (c->codec_type != AVMEDIA_TYPE_VIDEO ||
+                        !c->time_base.num)
                         continue;
                     fr = c->time_base.den * 1000 / c->time_base.num;
                     if (fr == 25000) {