Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()
@ 2024-05-16 23:19 Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127 Michael Niedermayer
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-16 23:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Helps: CID1548380 Uninitialized scalar variable

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

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 23a570bb807..4ce0cc58d05 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -98,6 +98,8 @@ static av_cold void rv34_gen_vlc_ext(const uint8_t *bits, int size, VLC *vlc,
     uint16_t cw[MAX_VLC_SIZE];
     int maxbits;
 
+    av_assert0(size > 0);
+
     for (int i = 0; i < size; i++)
         counts[bits[i]]++;
 
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
@ 2024-05-16 23:19 ` Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 3/5] avcodec/scpr3: Check add_dec() for failure Michael Niedermayer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-16 23:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Untested, i have no testcase nor does fate

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/scpr3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index 5271717ac79..79106ddcff8 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -42,7 +42,7 @@ static void renew_table3(uint32_t nsym, uint32_t *cntsum,
         freqs[d] = b;
         freqs1[d] = a;
         cnts[d] = c;
-        for (int q = a + 128 - 1 >> 7, f = (a + b - 1 >> 7) + 1; q < f; q++)
+        for (int q = a + 127 >> 7, f = a + b + 127 >> 7; q < f; q++)
             dectab[q] = d;
 
         a += b;
@@ -232,7 +232,7 @@ static int update_model6_to_7(PixelModel3 *m)
             cnts[j] = d;
         }
         p = (e + 127) >> 7;
-        k = ((f + e - 1) >> 7) + 1;
+        k = f + e + 127 >> 7;
         if (k > FF_ARRAY_ELEMS(n.dectab))
             return AVERROR_INVALIDDATA;
         for (i = 0; i < k - p; i++)
@@ -688,10 +688,10 @@ static int update_model3_to_7(PixelModel3 *m, uint8_t value)
         n.cntsum += n.cnts[e];
         n.freqs1[e] = c;
         g = n.freqs[e];
-        f = (c + g - 1 >> 7) + 1;
+        f = c + g + 127 >> 7;
         if (f > FF_ARRAY_ELEMS(n.dectab))
             return AVERROR_INVALIDDATA;
-        for (q = c + 128 - 1 >> 7; q < f; q++) {
+        for (q = c + 127 >> 7; q < f; q++) {
             n.dectab[q] = e;
         }
         c += g;
@@ -760,7 +760,7 @@ static int decode_value3(SCPRContext *s, uint32_t max, uint32_t *cntsum,
             freqs1[i] = e;
             g = (c + 127) >> 7;
             c += e;
-            q = ((c - 1) >> 7) + 1;
+            q = c + 127 >> 7;
             if (q > g) {
                 for (int j = 0; j < q - g; j++)
                     dectable[j + g] = i;
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] avcodec/scpr3: Check add_dec() for failure
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127 Michael Niedermayer
@ 2024-05-16 23:19 ` Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8() Michael Niedermayer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-16 23:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1441459 Improper use of negative value

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

diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index 79106ddcff8..45706123db0 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -465,6 +465,8 @@ static int decode_adaptive6(PixelModel3 *m, uint32_t code, uint32_t *value,
             return 0;
         grow_dec(m);
         c = add_dec(m, q, g, f);
+        if (c < 0)
+            return AVERROR_INVALIDDATA;
     }
 
     incr_cntdec(m, c);
@@ -868,11 +870,11 @@ static int decode_unit3(SCPRContext *s, PixelModel3 *m, uint32_t code, uint32_t
         sync_code3(gb, rc);
         break;
     case 6:
-        if (!decode_adaptive6(m, code, value, &a, &b)) {
+        ret = decode_adaptive6(m, code, value, &a, &b);
+        if (!ret)
             ret = update_model6_to_7(m);
-            if (ret < 0)
-                return AVERROR_INVALIDDATA;
-        }
+        if (ret < 0)
+            return ret;
         decode3(gb, rc, a, b);
         sync_code3(gb, rc);
         break;
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8()
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127 Michael Niedermayer
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 3/5] avcodec/scpr3: Check add_dec() for failure Michael Niedermayer
@ 2024-05-16 23:19 ` Michael Niedermayer
  2024-05-17  7:53   ` Andreas Rheinhardt
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation Michael Niedermayer
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-16 23:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1473562 Unchecked return value
Fixes: CID1473592 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/sga.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 0f42cf912b2..aca941e057e 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -254,11 +254,14 @@ static int decode_palmapdata(AVCodecContext *avctx)
     const int bits = (s->nb_pal + 1) / 2;
     GetByteContext *gb = &s->gb;
     GetBitContext pm;
+    int ret;
 
     bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
     if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
         return AVERROR_INVALIDDATA;
-    init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
+    ret = init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
+    if (ret < 0)
+        return ret;
 
     for (int y = 0; y < s->tiles_h; y++) {
         uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
@@ -277,11 +280,14 @@ static int decode_tiledata(AVCodecContext *avctx)
     SGAVideoContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
     GetBitContext tm;
+    int ret;
 
     bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
     if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
         return AVERROR_INVALIDDATA;
-    init_get_bits8(&tm, gb->buffer, s->tiledata_size);
+    ret = init_get_bits8(&tm, gb->buffer, s->tiledata_size);
+    if (ret < 0)
+        return ret;
 
     for (int n = 0; n < s->nb_tiles; n++) {
         uint8_t *dst = s->tileindex_data + n * 64;
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
                   ` (2 preceding siblings ...)
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8() Michael Niedermayer
@ 2024-05-16 23:19 ` Michael Niedermayer
  2024-05-19 16:05 ` [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Andreas Rheinhardt
  2024-06-02 19:14 ` Michael Niedermayer
  5 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-16 23:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1500284 Unintentional integer overflow

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

diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c
index 010d0c1ac35..17a08144597 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -226,8 +226,8 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
             v = abs(err);
             if (v > err_inf)
                 err_inf = v;
-            err2_matrix[i] += v * v;
-            err2 += v * v;
+            err2_matrix[i] += v * (int64_t)v;
+            err2 += v * (int64_t)v;
             sysErr[i] += block[i] - block1[i];
             blockSumErr += v;
             if (abs(block[i]) > maxout)
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8()
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8() Michael Niedermayer
@ 2024-05-17  7:53   ` Andreas Rheinhardt
  2024-05-17 21:01     ` Michael Niedermayer
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-05-17  7:53 UTC (permalink / raw)
  To: ffmpeg-devel

Michael Niedermayer:
> Fixes: CID1473562 Unchecked return value
> Fixes: CID1473592 Unchecked return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/sga.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/sga.c b/libavcodec/sga.c
> index 0f42cf912b2..aca941e057e 100644
> --- a/libavcodec/sga.c
> +++ b/libavcodec/sga.c
> @@ -254,11 +254,14 @@ static int decode_palmapdata(AVCodecContext *avctx)
>      const int bits = (s->nb_pal + 1) / 2;
>      GetByteContext *gb = &s->gb;
>      GetBitContext pm;
> +    int ret;
>  
>      bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
>      if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
>          return AVERROR_INVALIDDATA;
> -    init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
> +    ret = init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
> +    if (ret < 0)
> +        return ret;
>  
>      for (int y = 0; y < s->tiles_h; y++) {
>          uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
> @@ -277,11 +280,14 @@ static int decode_tiledata(AVCodecContext *avctx)
>      SGAVideoContext *s = avctx->priv_data;
>      GetByteContext *gb = &s->gb;
>      GetBitContext tm;
> +    int ret;
>  
>      bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
>      if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
>          return AVERROR_INVALIDDATA;
> -    init_get_bits8(&tm, gb->buffer, s->tiledata_size);
> +    ret = init_get_bits8(&tm, gb->buffer, s->tiledata_size);
> +    if (ret < 0)
> +        return ret;
>  
>      for (int n = 0; n < s->nb_tiles; n++) {
>          uint8_t *dst = s->tileindex_data + n * 64;

Both of these can not fail and could be checked via av_assert1:
palmapdata_size is given by (s->tiles_w * s->tiles_h * ((s->nb_pal + 1)
/ 2) + 7) / 8 with tiles_w and tiles_h being in the 0..255 range and
nb_pal being in the 0..4 range.
tiledata_size is given by s->nb_tiles * 32; nb_tiles fits in 16 bits (it
is either read via AV_RB16 or is given as the product of tiles_h *
tiles_w, both of which are read from simple uint8_t.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8()
  2024-05-17  7:53   ` Andreas Rheinhardt
@ 2024-05-17 21:01     ` Michael Niedermayer
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-17 21:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 2643 bytes --]

On Fri, May 17, 2024 at 09:53:21AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1473562 Unchecked return value
> > Fixes: CID1473592 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/sga.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/sga.c b/libavcodec/sga.c
> > index 0f42cf912b2..aca941e057e 100644
> > --- a/libavcodec/sga.c
> > +++ b/libavcodec/sga.c
> > @@ -254,11 +254,14 @@ static int decode_palmapdata(AVCodecContext *avctx)
> >      const int bits = (s->nb_pal + 1) / 2;
> >      GetByteContext *gb = &s->gb;
> >      GetBitContext pm;
> > +    int ret;
> >  
> >      bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
> >      if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
> >          return AVERROR_INVALIDDATA;
> > -    init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
> > +    ret = init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
> > +    if (ret < 0)
> > +        return ret;
> >  
> >      for (int y = 0; y < s->tiles_h; y++) {
> >          uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
> > @@ -277,11 +280,14 @@ static int decode_tiledata(AVCodecContext *avctx)
> >      SGAVideoContext *s = avctx->priv_data;
> >      GetByteContext *gb = &s->gb;
> >      GetBitContext tm;
> > +    int ret;
> >  
> >      bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
> >      if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
> >          return AVERROR_INVALIDDATA;
> > -    init_get_bits8(&tm, gb->buffer, s->tiledata_size);
> > +    ret = init_get_bits8(&tm, gb->buffer, s->tiledata_size);
> > +    if (ret < 0)
> > +        return ret;
> >  
> >      for (int n = 0; n < s->nb_tiles; n++) {
> >          uint8_t *dst = s->tileindex_data + n * 64;
> 
> Both of these can not fail and could be checked via av_assert1:
> palmapdata_size is given by (s->tiles_w * s->tiles_h * ((s->nb_pal + 1)
> / 2) + 7) / 8 with tiles_w and tiles_h being in the 0..255 range and
> nb_pal being in the 0..4 range.
> tiledata_size is given by s->nb_tiles * 32; nb_tiles fits in 16 bits (it
> is either read via AV_RB16 or is given as the product of tiles_h *
> tiles_w, both of which are read from simple uint8_t.

ill use av_assert1()

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
                   ` (3 preceding siblings ...)
  2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation Michael Niedermayer
@ 2024-05-19 16:05 ` Andreas Rheinhardt
  2024-05-19 19:48   ` Michael Niedermayer
  2024-06-02 19:14 ` Michael Niedermayer
  5 siblings, 1 reply; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-05-19 16:05 UTC (permalink / raw)
  To: ffmpeg-devel

Michael Niedermayer:
> Helps: CID1548380 Uninitialized scalar variable
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/rv34.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
> index 23a570bb807..4ce0cc58d05 100644
> --- a/libavcodec/rv34.c
> +++ b/libavcodec/rv34.c
> @@ -98,6 +98,8 @@ static av_cold void rv34_gen_vlc_ext(const uint8_t *bits, int size, VLC *vlc,
>      uint16_t cw[MAX_VLC_SIZE];
>      int maxbits;
>  
> +    av_assert0(size > 0);
> +
>      for (int i = 0; i < size; i++)
>          counts[bits[i]]++;
>  

An av_assert0 just because of Coverity? Why not av_assert1?

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()
  2024-05-19 16:05 ` [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Andreas Rheinhardt
@ 2024-05-19 19:48   ` Michael Niedermayer
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-05-19 19:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1136 bytes --]

On Sun, May 19, 2024 at 06:05:20PM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Helps: CID1548380 Uninitialized scalar variable
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/rv34.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
> > index 23a570bb807..4ce0cc58d05 100644
> > --- a/libavcodec/rv34.c
> > +++ b/libavcodec/rv34.c
> > @@ -98,6 +98,8 @@ static av_cold void rv34_gen_vlc_ext(const uint8_t *bits, int size, VLC *vlc,
> >      uint16_t cw[MAX_VLC_SIZE];
> >      int maxbits;
> >  
> > +    av_assert0(size > 0);
> > +
> >      for (int i = 0; i < size; i++)
> >          counts[bits[i]]++;
> >  
> 
> An av_assert0 just because of Coverity? Why not av_assert1?

the function is av_cold, so it doesnt really matter i think
but changed to av_assert1 locally

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()
  2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
                   ` (4 preceding siblings ...)
  2024-05-19 16:05 ` [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Andreas Rheinhardt
@ 2024-06-02 19:14 ` Michael Niedermayer
  5 siblings, 0 replies; 10+ messages in thread
From: Michael Niedermayer @ 2024-06-02 19:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 485 bytes --]

On Fri, May 17, 2024 at 01:19:28AM +0200, Michael Niedermayer wrote:
> Helps: CID1548380 Uninitialized scalar variable
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/rv34.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply remaining patches

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-02 19:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16 23:19 [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Michael Niedermayer
2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127 Michael Niedermayer
2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 3/5] avcodec/scpr3: Check add_dec() for failure Michael Niedermayer
2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8() Michael Niedermayer
2024-05-17  7:53   ` Andreas Rheinhardt
2024-05-17 21:01     ` Michael Niedermayer
2024-05-16 23:19 ` [FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation Michael Niedermayer
2024-05-19 16:05 ` [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext() Andreas Rheinhardt
2024-05-19 19:48   ` Michael Niedermayer
2024-06-02 19:14 ` Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git