[FFmpeg-devel] [PATCH] opt: do not crash in av_set_options_string() if opts == NULL
Stefano Sabatini
stefano.sabatini-lala at poste.it
Sun Jun 19 03:09:01 CEST 2011
Add missing NULL check, and updated documentation accordingly.
---
libavutil/opt.c | 2 ++
libavutil/opt.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index d57a547..a263842 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -518,6 +518,8 @@ int av_set_options_string(void *ctx, const char *opts,
{
int ret, count = 0;
+ if (!opts)
+ return 0;
while (*opts) {
if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
return ret;
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 872b554..a010a31 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -163,6 +163,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags);
* key. ctx must be an AVClass context, storing is done using
* AVOptions.
*
+ * @param opts options string to parse, may be NULL
* @param key_val_sep a 0-terminated list of characters used to
* separate key from value
* @param pairs_sep a 0-terminated list of characters used to separate
--
1.7.2.5
More information about the ffmpeg-devel
mailing list