On Thu, Nov 27, 2014 at 07:53:12PM +0100, Lukasz Marek wrote: > On 27 November 2014 at 15:05, Stefano Sabatini <[email protected]> wrote: > > > On date Tuesday 2014-11-25 20:38:59 +0100, Lukasz Marek encoded: > > > Patch attached. > > > > > From 2a9de161df4e1d0083264dde94ec5b8af59cec35 Mon Sep 17 00:00:00 2001 > > > From: Lukasz Marek <[email protected]> > > > Date: Tue, 25 Nov 2014 20:25:10 +0100 > > > Subject: [PATCH] lavu/opt: add escaping to av_opt_serialize > > > > > > Signed-off-by: Lukasz Marek <[email protected]> > > > --- > > > libavutil/opt.c | 12 +++++++++++- > > > libavutil/opt.h | 1 + > > > tests/ref/fate/opt | 7 +++++-- > > > 3 files changed, 17 insertions(+), 3 deletions(-) > > > > > > diff --git a/libavutil/opt.c b/libavutil/opt.c > > > index 0546a37..5b9cc35 100644 > > > --- a/libavutil/opt.c > > > +++ b/libavutil/opt.c > > > @@ -1843,6 +1843,11 @@ 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 == '\\') > > > + return AVERROR(EINVAL); > > > > maybe send a log here > > > > Added. > > > > > --- a/libavutil/opt.h > > > +++ b/libavutil/opt.h > > > @@ -887,6 +887,7 @@ int av_opt_is_set_to_default_by_name(void *obj, > > const char *name, int search_fla > > > * @param[in] key_val_sep character used to separate key from value > > > * @param[in] pairs_sep character used to separate two pairs from > > each other > > > * @return >= 0 on success, negative on error > > > + * @warning Separators cannot be neither '\\' nor '\0'. They also > > cannot be the same. > > > */ > > > > You could mention escaping in the docs, for example: > > > > A key/value or pairs separator occurring in the serialized value or > > name string are escaped through the av_escape() function. > > > > Added. > Updated patch attached.
> libavutil/opt.c | 14 +++++++++++++- > libavutil/opt.h | 3 +++ > tests/ref/fate/opt | 7 +++++-- > 3 files changed, 21 insertions(+), 3 deletions(-) > acd799e0dfcb7d0ac248ab48b2a3f55bf970cb5d > 0001-lavu-opt-add-escaping-to-av_opt_serialize.patch > From e84ba5a67d74f58b59f5fa30bdb60df856c4c29e Mon Sep 17 00:00:00 2001 > From: Lukasz Marek <[email protected]> > Date: Tue, 25 Nov 2014 20:25:10 +0100 > Subject: [PATCH] lavu/opt: add escaping to av_opt_serialize > > Signed-off-by: Lukasz Marek <[email protected]> LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
