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

Justin Ruggles git at videolan.org
Sun Dec 23 13:51:17 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Thu Nov  8 18:35:49 2012 -0500| [d02202e08a994c6c80f0256ae756698541b59902] | committer: Justin Ruggles

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

CC: libav-stable at libav.org

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

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

diff --git a/libavutil/opt.c b/libavutil/opt.c
index e199170..8a98a9e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -37,8 +37,10 @@
 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