avformat/utils: Fix integer overflow in discontinuity check
[ffmpeg.git] / ffmpeg_opt.c
index 669976b..304a4d4 100644 (file)
@@ -2366,18 +2366,25 @@ loop_end:
 
         while(*p) {
             const char *p2 = av_get_token(&p, ":");
+            const char *to_dealloc = p2;
             char *key;
             if (!p2)
                 break;
+
             if(*p) p++;
 
             key = av_get_token(&p2, "=");
-            if (!key || !*p2)
+            if (!key || !*p2) {
+                av_freep(&to_dealloc);
+                av_freep(&key);
                 break;
+            }
             p2++;
 
             if (!strcmp(key, "program_num"))
                 progid = strtol(p2, NULL, 0);
+            av_freep(&to_dealloc);
+            av_freep(&key);
         }
 
         program = av_new_program(oc, progid);
@@ -2385,6 +2392,7 @@ loop_end:
         p = o->program[i].u.str;
         while(*p) {
             const char *p2 = av_get_token(&p, ":");
+            const char *to_dealloc = p2;
             char *key;
             if (!p2)
                 break;
@@ -2411,6 +2419,8 @@ loop_end:
                 av_log(NULL, AV_LOG_FATAL, "Unknown program key %s.\n", key);
                 exit_program(1);
             }
+            av_freep(&to_dealloc);
+            av_freep(&key);
         }
     }
 
@@ -2979,8 +2989,8 @@ enum OptGroup {
 };
 
 static const OptionGroupDef groups[] = {
-    [GROUP_OUTFILE] = { "output file",  NULL, OPT_OUTPUT },
-    [GROUP_INFILE]  = { "input file",   "i",  OPT_INPUT },
+    [GROUP_OUTFILE] = { "output url",  NULL, OPT_OUTPUT },
+    [GROUP_INFILE]  = { "input url",   "i",  OPT_INPUT },
 };
 
 static int open_files(OptionGroupList *l, const char *inout,