avfilter/af_chorus & aecho: Handle NULL return from av_strtok()
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Mar 2017 20:12:13 +0000 (22:12 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Mar 2017 21:35:18 +0000 (23:35 +0200)
Fixes CID1396260

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/af_aecho.c
libavfilter/af_chorus.c

index 82049e9..cfaea3d 100644 (file)
@@ -77,7 +77,8 @@ static void fill_items(char *item_str, int *nb_items, float *items)
     for (i = 0; i < *nb_items; i++) {
         char *tstr = av_strtok(p, "|", &saveptr);
         p = NULL;
-        new_nb_items += sscanf(tstr, "%f", &items[i]) == 1;
+        if (tstr)
+            new_nb_items += sscanf(tstr, "%f", &items[new_nb_items]) == 1;
     }
 
     *nb_items = new_nb_items;
index c596164..87c8290 100644 (file)
@@ -96,7 +96,8 @@ static void fill_items(char *item_str, int *nb_items, float *items)
     for (i = 0; i < *nb_items; i++) {
         char *tstr = av_strtok(p, "|", &saveptr);
         p = NULL;
-        new_nb_items += sscanf(tstr, "%f", &items[i]) == 1;
+        if (tstr)
+            new_nb_items += sscanf(tstr, "%f", &items[new_nb_items]) == 1;
     }
 
     *nb_items = new_nb_items;