[FFmpeg-cvslog] opt: avoid segfault in av_opt_next() if the class does not have an option list

Justin Ruggles git at videolan.org
Thu Jan 17 02:41:29 CET 2013


ffmpeg | branch: release/0.10 | Justin Ruggles <justin.ruggles at gmail.com> | Thu Nov  8 18:35:49 2012 -0500| [dfb7a638e6b9d4b86b7e3c5cf97bdd7621adc5f6] | committer: Reinhard Tartler

opt: avoid segfault in av_opt_next() if the class does not have an option list

CC: libav-stable at libav.org
(cherry picked from commit d02202e08a994c6c80f0256ae756698541b59902)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavutil/opt.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 7c53024..aea381e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -57,8 +57,10 @@ const AVOption *av_next_option(void *obj, const AVOption *last)
 const AVOption *av_opt_next(void *obj, const AVOption *last)
 {
     AVClass *class = *(AVClass**)obj;
-    if (!last && class->option[0].name) return class->option;
-    if (last && last[1].name)           return ++last;
+    if (!last && class->option && class->option[0].name)
+        return class->option;
+    if (last && last[1].name)
+        return ++last;
     return NULL;
 }
 



More information about the ffmpeg-cvslog mailing list