diff mbox series

[FFmpeg-devel,1/9] avcodec/vqcdec: Check init_get_bits8() for failure

Message ID 20240519024915.1944150-1-michael@niedermayer.cc
State Accepted
Commit 6a9302739f5b20791eac7f40d9d999f822227fd1
Headers show
Series [FFmpeg-devel,1/9] avcodec/vqcdec: Check init_get_bits8() for failure | 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, 2024, 2:49 a.m. UTC
Fixes: CID1516090 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vqcdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Peter Ross May 19, 2024, 3:18 a.m. UTC | #1
On Sun, May 19, 2024 at 04:49:07AM +0200, Michael Niedermayer wrote:
> Fixes: CID1516090 Unchecked return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vqcdec.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
> index 5c6cab3c1ab..bb69844327d 100644
> --- a/libavcodec/vqcdec.c
> +++ b/libavcodec/vqcdec.c
> @@ -147,10 +147,13 @@ static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wid
>      GetBitContext gb;
>      uint8_t * vectors = s->vectors;
>      uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
> +    int ret;
>  
>      memset(vectors, 0, 3 * width * height / 2);
>  
> -    init_get_bits8(&gb, buf, size);
> +    ret = init_get_bits8(&gb, buf, size);
> +    if (ret < 0)
> +        return ret;
>  
>      for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
>          uint8_t * dst = vectors;

ok

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
Michael Niedermayer May 19, 2024, 7:37 p.m. UTC | #2
On Sun, May 19, 2024 at 01:18:09PM +1000, Peter Ross wrote:
> On Sun, May 19, 2024 at 04:49:07AM +0200, Michael Niedermayer wrote:
> > Fixes: CID1516090 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vqcdec.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
> > index 5c6cab3c1ab..bb69844327d 100644
> > --- a/libavcodec/vqcdec.c
> > +++ b/libavcodec/vqcdec.c
> > @@ -147,10 +147,13 @@ static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wid
> >      GetBitContext gb;
> >      uint8_t * vectors = s->vectors;
> >      uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
> > +    int ret;
> >  
> >      memset(vectors, 0, 3 * width * height / 2);
> >  
> > -    init_get_bits8(&gb, buf, size);
> > +    ret = init_get_bits8(&gb, buf, size);
> > +    if (ret < 0)
> > +        return ret;
> >  
> >      for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
> >          uint8_t * dst = vectors;
> 
> ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 5c6cab3c1ab..bb69844327d 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -147,10 +147,13 @@  static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wid
     GetBitContext gb;
     uint8_t * vectors = s->vectors;
     uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
+    int ret;
 
     memset(vectors, 0, 3 * width * height / 2);
 
-    init_get_bits8(&gb, buf, size);
+    ret = init_get_bits8(&gb, buf, size);
+    if (ret < 0)
+        return ret;
 
     for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
         uint8_t * dst = vectors;