[FFmpeg-devel] lavu/opt: add escaping to av_opt_serialize

Stefano Sabatini stefasab at gmail.com
Fri Nov 28 18:51:34 CET 2014


On date Thursday 2014-11-27 19:53:12 +0100, Lukasz Marek encoded:
[...]
> From e84ba5a67d74f58b59f5fa30bdb60df856c4c29e Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Tue, 25 Nov 2014 20:25:10 +0100
> Subject: [PATCH] lavu/opt: add escaping to av_opt_serialize
> 
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  libavutil/opt.c    | 14 +++++++++++++-
>  libavutil/opt.h    |  3 +++
>  tests/ref/fate/opt |  7 +++++--
>  3 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 5b26a00..2f8ea0c 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1846,6 +1846,13 @@ int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
>      uint8_t *buf;
>      AVBPrint bprint;
>      int ret, cnt = 0;
> +    const char special_chars[] = {pairs_sep, key_val_sep, '\0'};
> +
> +    if (pairs_sep == '\0' || key_val_sep == '\0' || pairs_sep == key_val_sep ||
> +        pairs_sep == '\\' || key_val_sep == '\\') {
> +        av_log(obj, AV_LOG_ERROR, "Invalid separator(s).");

Nit++: Invalid separator(s) found

[...]

LGTM otherwise (no need to send another patch of course), thanks.
-- 
FFmpeg = Friendly and Furious Meaningless Political Exploitable Ghost


More information about the ffmpeg-devel mailing list