[FFmpeg-devel] [PATCH] avformat/matroskadec: Prevent access of elements after freeing by set nb_elem to zero.

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Fri Nov 25 22:19:51 EET 2016


On 25.11.2016 11:04, Schenk, Michael wrote:
> From 9d2d5127a3113b6581b0a562776c3ec92c547bdb Mon Sep 17 00:00:00 2001
> From: Michael Schenk <michael.schenk at albis-elcon.com>
> Date: Fri, 25 Nov 2016 09:36:20 +0100
> Subject: [PATCH] set nb_elem to 0 after freeing to avoid further access which
>  may causing SEGV due to access to the element somewhere after

Please split this into a short subject starting with 'matroskadec:' followed
by a more detailed explanation in the body.

> ---
>  libavformat/matroskadec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index f79511e..d96e861 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1237,6 +1237,7 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
>                       j++, ptr += syntax[i].list_elem_size)
>                      ebml_free(syntax[i].def.n, ptr);
>                  av_freep(&list->elem);
> +                list->nb_elem = 0;
>              } else
>                  ebml_free(syntax[i].def.n, data_off);
>          default:
> -- 2.7.4

The change itself looks good.

Best regards,
Andreas


More information about the ffmpeg-devel mailing list