[FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: assert non NULL buf

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri May 20 10:17:50 EEST 2022


Michael Niedermayer:
> The code is only called if size is > 0 so buf should not be NULL
> 
> Helps: CID610554
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavformat/matroskadec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 4715f1b7d4..de73f97aca 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -3701,6 +3701,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf
>      uint64_t num;
>      int trust_default_duration;
>  
> +    av_assert1(buf);
> +
>      ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL);
>  
>      if ((n = ebml_read_num(matroska, &pb.pub, 8, &num, 1)) < 0)

Ok.

- Andreas


More information about the ffmpeg-devel mailing list