Browse Source

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>
tags/n2.5
Lukasz Marek 10 years ago
parent
commit
bb60142f56
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavutil/opt.c

+ 4
- 1
libavutil/opt.c View File

@@ -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;


Loading…
Cancel
Save