aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki2@gmail.com>2014-11-09 23:15:58 +0100
committerLukasz Marek <lukasz.m.luki2@gmail.com>2014-11-11 21:52:26 +0100
commitbb60142f562ef9ca7f34bd69abe059d56ea1cbf1 (patch)
tree95a510a936fd0e3b3fb0bab1d72c8bfae00ef9b1
parent7edb5eec4fd407c55c437aaa5a38d7c8a953c14c (diff)
downloadffmpeg-bb60142f562ef9ca7f34bd69abe059d56ea1cbf1.tar.gz
lavu/opt: check for NULL before parsing
set_string_binary crashes when called with val==NULL Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
-rw-r--r--libavutil/opt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index fca5354971..c064357f70 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;