avfilter/af_chorus & aecho: Handle NULL return from av_strtok()

Fixes CID1396260

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/258/head
Michael Niedermayer 8 years ago
parent fe46d92c15
commit 477ba8f939
  1. 3
      libavfilter/af_aecho.c
  2. 3
      libavfilter/af_chorus.c

@ -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;

@ -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;

Loading…
Cancel
Save