On Sun, Nov 09, 2014 at 11:22:46PM +0100, Lukasz Marek wrote:
> 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);

this deallocates dest and then returns failure
shouldnt it either not fail or not change the state of dst ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch

Attachment: signature.asc
Description: Digital signature

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

Reply via email to