[FFmpeg-cvslog] lavu/opt: check for NULL before parsing

Lukasz Marek git at videolan.org
Tue Nov 11 21:53:22 CET 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Sun Nov  9 23:15:58 2014 +0100| [bb60142f562ef9ca7f34bd69abe059d56ea1cbf1] | committer: Lukasz Marek

lavu/opt: check for NULL before parsing

set_string_binary crashes when called with val==NULL

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>

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

 libavutil/opt.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index fca5354..c064357 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -126,11 +126,14 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
 {
     int *lendst = (int *)(dst + 1);
     uint8_t *bin, *ptr;
-    int len = strlen(val);
+    int len;
 
     av_freep(dst);
     *lendst = 0;
 
+    if (!val || !(len = strlen(val)))
+        return 0;
+
     if (len & 1)
         return AVERROR(EINVAL);
     len /= 2;



More information about the ffmpeg-cvslog mailing list