diff options
author | Simon Thelen <ffmpeg-dev@c-14.de> | 2015-06-20 18:52:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-20 19:51:14 +0200 |
commit | 7cbb52ecab90206eccb8cb629019d3a7816769f0 (patch) | |
tree | bc01e3e8e19ff6dc9cb8783d94c43d4e268a77f0 /libavfilter | |
parent | 6b547180b9493877b83f3379f054e24108ca9fa5 (diff) | |
download | ffmpeg-7cbb52ecab90206eccb8cb629019d3a7816769f0.tar.gz |
libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/formats.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 2451bf70c9..8758b3d113 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -637,23 +637,20 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx) { char *tail; - int64_t chlayout, count; + int64_t chlayout; - if (nret) { - count = strtol(arg, &tail, 10); - if (*tail == 'c' && !tail[1] && count > 0 && count < 63) { - *nret = count; - *ret = 0; - return 0; - } - } chlayout = av_get_channel_layout(arg); if (chlayout == 0) { chlayout = strtol(arg, &tail, 10); - if (*tail || chlayout == 0) { + if (!(*tail == '\0' || *tail == 'c' && *(tail + 1) == '\0') || chlayout <= 0 || chlayout > 63) { av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg); return AVERROR(EINVAL); } + if (nret) { + *nret = chlayout; + *ret = 0; + return 0; + } } *ret = chlayout; if (nret) |