diff mbox series

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

Message ID 20220519234312.11733-1-michael@niedermayer.cc
State Accepted
Commit d84f03609ef36db0cdc48b3bbce3c5cd04bf18a1
Headers show
Series [FFmpeg-devel,1/2] avformat/matroskadec: assert non NULL buf | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer May 19, 2022, 11:43 p.m. UTC
The code is only called if size is > 0 so buf should not be NULL

Helps: CID610554

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/matroskadec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andreas Rheinhardt May 20, 2022, 7:17 a.m. UTC | #1
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@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
Michael Niedermayer May 26, 2022, 8:41 a.m. UTC | #2
On Fri, May 20, 2022 at 09:17:50AM +0200, Andreas Rheinhardt wrote:
> 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@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.

will apply

thx

[...]
diff mbox series

Patch

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)