Commit 88612f8d authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/af_compand: Check av_strtok() for failure

Fixes CID1396256
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 164758a8
...@@ -368,6 +368,10 @@ static int config_output(AVFilterLink *outlink) ...@@ -368,6 +368,10 @@ static int config_output(AVFilterLink *outlink)
p = s->attacks; p = s->attacks;
for (i = 0, new_nb_items = 0; i < nb_attacks; i++) { for (i = 0, new_nb_items = 0; i < nb_attacks; i++) {
char *tstr = av_strtok(p, " |", &saveptr); char *tstr = av_strtok(p, " |", &saveptr);
if (!tstr) {
uninit(ctx);
return AVERROR(EINVAL);
}
p = NULL; p = NULL;
new_nb_items += sscanf(tstr, "%lf", &s->channels[i].attack) == 1; new_nb_items += sscanf(tstr, "%lf", &s->channels[i].attack) == 1;
if (s->channels[i].attack < 0) { if (s->channels[i].attack < 0) {
...@@ -380,6 +384,10 @@ static int config_output(AVFilterLink *outlink) ...@@ -380,6 +384,10 @@ static int config_output(AVFilterLink *outlink)
p = s->decays; p = s->decays;
for (i = 0, new_nb_items = 0; i < nb_decays; i++) { for (i = 0, new_nb_items = 0; i < nb_decays; i++) {
char *tstr = av_strtok(p, " |", &saveptr); char *tstr = av_strtok(p, " |", &saveptr);
if (!tstr) {
uninit(ctx);
return AVERROR(EINVAL);
}
p = NULL; p = NULL;
new_nb_items += sscanf(tstr, "%lf", &s->channels[i].decay) == 1; new_nb_items += sscanf(tstr, "%lf", &s->channels[i].decay) == 1;
if (s->channels[i].decay < 0) { if (s->channels[i].decay < 0) {
...@@ -407,7 +415,7 @@ static int config_output(AVFilterLink *outlink) ...@@ -407,7 +415,7 @@ static int config_output(AVFilterLink *outlink)
for (i = 0, new_nb_items = 0; i < nb_points; i++) { for (i = 0, new_nb_items = 0; i < nb_points; i++) {
char *tstr = av_strtok(p, " |", &saveptr); char *tstr = av_strtok(p, " |", &saveptr);
p = NULL; p = NULL;
if (sscanf(tstr, "%lf/%lf", &S(i).x, &S(i).y) != 2) { if (!tstr || sscanf(tstr, "%lf/%lf", &S(i).x, &S(i).y) != 2) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Invalid and/or missing input/output value.\n"); "Invalid and/or missing input/output value.\n");
uninit(ctx); uninit(ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment