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

Lukasz Marek lukasz.m.luki2 at gmail.com
Sat Nov 29 01:11:06 CET 2014


On 28.11.2014 18:51, Stefano Sabatini wrote:
> 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

Added.

> LGTM otherwise (no need to send another patch of course), thanks.

Thx and pushed.
BTW, sorry I didn't add it in introduce patch, but for not sane reason I 
assumed unescaping is not supported in av_opt_set_from_string and friends.



More information about the ffmpeg-devel mailing list