[FFmpeg-cvslog] avutil/opt: dont crash on av_opt_set_dict() with NULL

Michael Niedermayer git at videolan.org
Sun Mar 30 15:20:47 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar 30 14:58:46 2014 +0200| [d9a3501c33a1f88350c935785dbf5435e9ffabe6] | committer: Michael Niedermayer

avutil/opt: dont crash on av_opt_set_dict() with NULL

This allows calling the function without the need to check if the
dictionary contains any entries

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9a3501c33a1f88350c935785dbf5435e9ffabe6
---

 libavutil/opt.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 652a2dd..428c4e5 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1421,6 +1421,9 @@ int av_opt_set_dict(void *obj, AVDictionary **options)
     AVDictionary    *tmp = NULL;
     int ret = 0;
 
+    if (!options)
+        return 0;
+
     while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
         ret = av_opt_set(obj, t->key, t->value, 0);
         if (ret == AVERROR_OPTION_NOT_FOUND)



More information about the ffmpeg-cvslog mailing list