Alex Converse <[email protected]> writes:

> From: Michael Niedermayer <[email protected]>
>
> This can easily be NULL as string_size can be 2g in a damaged file.
>
> Signed-off-by: Michael Niedermayer <[email protected]>
> (cherry picked from commit b9e0e9537a3ec4af1630e9f1b8d0ce68885cac16)
>
> Signed-off-by: Alex Converse <[email protected]>
> ---
>  libavformat/nsvdec.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
> index 18dfde2..52f81f1 100644
> --- a/libavformat/nsvdec.c
> +++ b/libavformat/nsvdec.c
> @@ -315,6 +315,8 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, 
> AVFormatParameters *ap)
>          char quote;
>
>          p = strings = av_mallocz(strings_size + 1);
> +        if (!p)
> +            return AVERROR(ENOMEM);
>          endp = strings + strings_size;
>          avio_read(pb, strings, strings_size);
>          while (p < endp) {
> -- 

Commit messages makes no sense.

That said, *all* malloc() calls should be checked, no exceptions.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to