1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-05 18:01:59 +02:00

avfilter/af_headphone: Don't use uninitialized buffer in log message

This buffer was supposed to be initialized by sscanf(input, "%7[A-Z]%n",
buf, &len), yet if the first input character is not in the A-Z range,
buf is not touched (in particular it needn't be zero-terminated if the
failure happened when parsing the first channel and it still contains
the last channel name if the failure happened when one channel name
could be successfully parsed). This is treated as error in which case
buf is used directly in the log message. This commit fixes this by
actually using the string that could not be matched in the log message
instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-08-24 06:08:56 +02:00
parent 3c7cad69f2
commit e2d4a5807f

View File

@ -135,7 +135,7 @@ static void parse_map(AVFilterContext *ctx)
p = NULL;
if (parse_channel_name(s, s->nb_irs, &arg, &out_ch_id, buf)) {
av_log(ctx, AV_LOG_WARNING, "Failed to parse \'%s\' as channel name.\n", buf);
av_log(ctx, AV_LOG_WARNING, "Failed to parse \'%s\' as channel name.\n", arg);
continue;
}
s->mapping[s->nb_irs] = out_ch_id;