diff mbox

[FFmpeg-devel,2/2] avfilter/af_chorus & aecho: Handle NULL return from av_strtok()

Message ID 20170330201213.15861-2-michael@niedermayer.cc
State Accepted
Commit 477ba8f9391f779b7927305c89b5c24120930925
Headers show

Commit Message

Michael Niedermayer March 30, 2017, 8:12 p.m. UTC
Fixes CID1396260

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_aecho.c  | 3 ++-
 libavfilter/af_chorus.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Paul B Mahol March 30, 2017, 8:15 p.m. UTC | #1
On 3/30/17, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes CID1396260
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/af_aecho.c  | 3 ++-
>  libavfilter/af_chorus.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>

ok
diff mbox

Patch

diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c
index 82049e9541..cfaea3de43 100644
--- a/libavfilter/af_aecho.c
+++ b/libavfilter/af_aecho.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;
diff --git a/libavfilter/af_chorus.c b/libavfilter/af_chorus.c
index c596164382..87c8290097 100644
--- a/libavfilter/af_chorus.c
+++ b/libavfilter/af_chorus.c
@@ -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;