set_string_binary crashes with called with val=NULL

Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com>
---
 libavutil/opt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index fca5354..bc62044 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -126,11 +126,15 @@ 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)
+        return AVERROR(EINVAL);
+
+    len = strlen(val);
     if (len & 1)
         return AVERROR(EINVAL);
     len /= 2;
-- 
1.9.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to