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/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill()
@ 2024-05-18  3:57 Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray() Michael Niedermayer
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Helps: CID1441167 Unchecked return value

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 19301d9e490..ca7e9f6aba9 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -422,7 +422,8 @@ static void av_always_inline horizontal_fill(TiffContext *s,
             uint8_t shift = is_dng ? 0 : 16 - bpp;
             GetBitContext gb;
 
-            init_get_bits8(&gb, src, width);
+            int ret = init_get_bits8(&gb, src, width);
+            av_assert1(ret >= 0);
             for (int i = 0; i < s->width; i++) {
                 dst16[i] = get_bits(&gb, bpp) << shift;
             }
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  6:02   ` Andreas Rheinhardt
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 3/9] avcodec/vble: Check av_image_get_buffer_size() for failure Michael Niedermayer
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Helps: CID1441939 Unchecked return value

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index ca7e9f6aba9..31de6ad7308 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
     GetBitContext gb;
     uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
 
-    init_get_bits8(&gb, src, width);
+    int ret = init_get_bits8(&gb, src, width);
+    av_assert1(ret >= 0);
 
     for (int i = 0; i < s->width; i++) {
         dst[i] = get_bits(&gb, bpp);
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 3/9] avcodec/vble: Check av_image_get_buffer_size() for failure
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 4/9] avcodec/vc1_block: remove unused off from vc1_decode_p_mb_intfr() Michael Niedermayer
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1461482 Improper use of negative value

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

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index 32157913c77..c585b1ed9fc 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -191,6 +191,9 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
     ctx->size = av_image_get_buffer_size(avctx->pix_fmt,
                                          avctx->width, avctx->height, 1);
 
+    if (ctx->size < 0)
+        return ctx->size;
+
     ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val));
 
     if (!ctx->val) {
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 4/9] avcodec/vc1_block: remove unused off from vc1_decode_p_mb_intfr()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray() Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 3/9] avcodec/vble: Check av_image_get_buffer_size() for failure Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 5/9] avcodec/vc1_block: remove unneeded store to off in vc1_decode_p_mb_intfi() Michael Niedermayer
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1435166 Unused value
Fixes: CID1529221 Unused value

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

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index a6ee4922f95..1e8e294ad89 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1607,10 +1607,6 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
                 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
                     continue;
                 v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
-                if (i < 4)
-                    off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;
-                else
-                    off = 0;
                 block_cbp |= 0xf << (i << 2);
             }
 
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 5/9] avcodec/vc1_block: remove unneeded store to off in vc1_decode_p_mb_intfi()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (2 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 4/9] avcodec/vc1_block: remove unused off from vc1_decode_p_mb_intfr() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 6/9] avcodec/vc1_parser: Assert init_get_bits success Michael Niedermayer
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Found while reviewing code related to coverity

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

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 1e8e294ad89..322acebfe50 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1771,7 +1771,6 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
             if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
                 continue;
             v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
-            off  = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
             block_cbp |= 0xf << (i << 2);
         }
     } else {
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 6/9] avcodec/vc1_parser: Assert init_get_bits success
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (3 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 5/9] avcodec/vc1_block: remove unneeded store to off in vc1_decode_p_mb_intfi() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths() Michael Niedermayer
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

The buffer used is a fixed size buffer from the context, it cannot be too large nor
can it be NULL

Helps: CID1441935 Unchecked return value

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

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index ec284dca009..a1557b1ec7e 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -66,7 +66,9 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx,
     GetBitContext gb;
     int ret;
     vpc->v.s.avctx = avctx;
-    init_get_bits8(&gb, buf, buf_size);
+    ret = init_get_bits8(&gb, buf, buf_size);
+    av_assert1(ret >= 0);
+
     switch (vpc->prev_start_code) {
     case VC1_CODE_SEQHDR & 0xFF:
         ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb);
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (4 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 6/9] avcodec/vc1_parser: Assert init_get_bits success Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder() Michael Niedermayer
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1544630 Resource leak

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

diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
index ee09d96fd61..f46ecbb55e9 100644
--- a/libavcodec/vlc.c
+++ b/libavcodec/vlc.c
@@ -529,7 +529,7 @@ int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int
 
     multi->table = av_malloc(sizeof(*multi->table) << nb_bits);
     if (!multi->table)
-        return AVERROR(ENOMEM);
+        goto fail;
 
     j = code = 0;
     for (int i = 0; i < nb_codes; i++, lens += lens_wrap) {
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (5 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18 15:07   ` Ronald S. Bultje
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert Michael Niedermayer
  2024-05-27 23:59 ` [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
  8 siblings, 1 reply; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1507483 Unchecked return value

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

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 19f32b34006..8e91613068a 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)
     }
 
     s->coeff_partition_size[i] = buf_size;
-    ff_vpx_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
 
-    return 0;
+    return ff_vpx_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
 }
 
 static void vp7_get_quants(VP8Context *s)
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (6 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder() Michael Niedermayer
@ 2024-05-18  3:57 ` Michael Niedermayer
  2024-05-18  8:33   ` Peter Ross
  2024-05-27 23:59 ` [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
  8 siblings, 1 reply; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1452425 Logically dead code

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

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 09527607767..d03a1c9dbc1 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int plane, int motion_x, int
         x_offset = (-(x + 2) & 7) + 2;
         y_offset = (-(y + 2) & 7) + 2;
 
-        if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
-            return 0;
+        av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
 
         s->vdsp.emulated_edge_mc(loop, motion_source - stride - 1,
              loop_stride, stride,
-- 
2.45.1

_______________________________________________
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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray() Michael Niedermayer
@ 2024-05-18  6:02   ` Andreas Rheinhardt
  2024-05-18 19:45     ` Michael Niedermayer
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Rheinhardt @ 2024-05-18  6:02 UTC (permalink / raw)
  To: ffmpeg-devel

Michael Niedermayer:
> Helps: CID1441939 Unchecked return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tiff.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index ca7e9f6aba9..31de6ad7308 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
>      GetBitContext gb;
>      uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
>  
> -    init_get_bits8(&gb, src, width);
> +    int ret = init_get_bits8(&gb, src, width);
> +    av_assert1(ret >= 0);
>  
>      for (int i = 0; i < s->width; i++) {
>          dst[i] = get_bits(&gb, bpp);

What guarantees that this is not triggered?

- 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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert Michael Niedermayer
@ 2024-05-18  8:33   ` Peter Ross
  2024-05-19 19:44     ` Michael Niedermayer
  0 siblings, 1 reply; 16+ messages in thread
From: Peter Ross @ 2024-05-18  8:33 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, May 18, 2024 at 05:57:43AM +0200, Michael Niedermayer wrote:
> Fixes: CID1452425 Logically dead code
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vp3.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index 09527607767..d03a1c9dbc1 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int plane, int motion_x, int
>          x_offset = (-(x + 2) & 7) + 2;
>          y_offset = (-(y + 2) & 7) + 2;
>  
> -        if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
> -            return 0;
> +        av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
>  

ok

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

[-- 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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder()
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder() Michael Niedermayer
@ 2024-05-18 15:07   ` Ronald S. Bultje
  2024-05-19 19:43     ` Michael Niedermayer
  0 siblings, 1 reply; 16+ messages in thread
From: Ronald S. Bultje @ 2024-05-18 15:07 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi,

On Fri, May 17, 2024 at 11:59 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: CID1507483 Unchecked return value
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vp8.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 19f32b34006..8e91613068a 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const
> uint8_t *buf, int buf_size)
>      }
>
>      s->coeff_partition_size[i] = buf_size;
> -    ff_vpx_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
>
> -    return 0;
> +    return ff_vpx_init_range_decoder(&s->coeff_partition[i], buf,
> buf_size);
>  }
>
>  static void vp7_get_quants(VP8Context *s)
> --
> 2.45.1
>

OK.

Ronald
_______________________________________________
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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()
  2024-05-18  6:02   ` Andreas Rheinhardt
@ 2024-05-18 19:45     ` Michael Niedermayer
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-18 19:45 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, May 18, 2024 at 08:02:28AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Helps: CID1441939 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/tiff.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index ca7e9f6aba9..31de6ad7308 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
> >      GetBitContext gb;
> >      uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
> >  
> > -    init_get_bits8(&gb, src, width);
> > +    int ret = init_get_bits8(&gb, src, width);
> > +    av_assert1(ret >= 0);
> >  
> >      for (int i = 0; i < s->width; i++) {
> >          dst[i] = get_bits(&gb, bpp);
> 
> What guarantees that this is not triggered?

Several arguments, first one is simply that linesize*allocated_height must be addressable with an int index
which in practice ends on the check "stride*(uint64_t)(h+128) >= INT_MAX" in av_image_check_size2

so I would expect a width * 8 not to overflow if a stride * (h+128) cannot
(this is a bit fuzzy as our width can contain some subsampling factors though i
doubt they can be that large)

the 2nd is that
int width = ((s->width * s->bpp) + 7) >> 3;
or teh alethernative path contains a av_assert0(width <= bytes_per_row);
where int bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
                            s->subsampling[0] * s->subsampling[1] + 7) >> 3;
both are integers divided by 8 so i would expect no overflow on a multiply by 8

thx

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides

[-- 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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder()
  2024-05-18 15:07   ` Ronald S. Bultje
@ 2024-05-19 19:43     ` Michael Niedermayer
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-19 19:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, May 18, 2024 at 11:07:15AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Fri, May 17, 2024 at 11:59 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Fixes: CID1507483 Unchecked return value
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vp8.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> > index 19f32b34006..8e91613068a 100644
> > --- a/libavcodec/vp8.c
> > +++ b/libavcodec/vp8.c
> > @@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const
> > uint8_t *buf, int buf_size)
> >      }
> >
> >      s->coeff_partition_size[i] = buf_size;
> > -    ff_vpx_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
> >
> > -    return 0;
> > +    return ff_vpx_init_range_decoder(&s->coeff_partition[i], buf,
> > buf_size);
> >  }
> >
> >  static void vp7_get_quants(VP8Context *s)
> > --
> > 2.45.1
> >
> 
> OK.

will apply

thx

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

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown

[-- 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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert
  2024-05-18  8:33   ` Peter Ross
@ 2024-05-19 19:44     ` Michael Niedermayer
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-19 19:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, May 18, 2024 at 06:33:12PM +1000, Peter Ross wrote:
> On Sat, May 18, 2024 at 05:57:43AM +0200, Michael Niedermayer wrote:
> > Fixes: CID1452425 Logically dead code
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vp3.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> > index 09527607767..d03a1c9dbc1 100644
> > --- a/libavcodec/vp3.c
> > +++ b/libavcodec/vp3.c
> > @@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int plane, int motion_x, int
> >          x_offset = (-(x + 2) & 7) + 2;
> >          y_offset = (-(y + 2) & 7) + 2;
> >  
> > -        if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
> > -            return 0;
> > +        av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
> >  
> 
> ok

will apply

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato

[-- 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] 16+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill()
  2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
                   ` (7 preceding siblings ...)
  2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert Michael Niedermayer
@ 2024-05-27 23:59 ` Michael Niedermayer
  8 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-05-27 23:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, May 18, 2024 at 05:57:35AM +0200, Michael Niedermayer wrote:
> Helps: CID1441167 Unchecked return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tiff.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply the patches which have not been applied yet from this set

thx

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

What does censorship reveal? It reveals fear. -- Julian Assange

[-- 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] 16+ messages in thread

end of thread, other threads:[~2024-05-28  0:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-18  3:57 [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray() Michael Niedermayer
2024-05-18  6:02   ` Andreas Rheinhardt
2024-05-18 19:45     ` Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 3/9] avcodec/vble: Check av_image_get_buffer_size() for failure Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 4/9] avcodec/vc1_block: remove unused off from vc1_decode_p_mb_intfr() Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 5/9] avcodec/vc1_block: remove unneeded store to off in vc1_decode_p_mb_intfi() Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 6/9] avcodec/vc1_parser: Assert init_get_bits success Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths() Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder() Michael Niedermayer
2024-05-18 15:07   ` Ronald S. Bultje
2024-05-19 19:43     ` Michael Niedermayer
2024-05-18  3:57 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert Michael Niedermayer
2024-05-18  8:33   ` Peter Ross
2024-05-19 19:44     ` Michael Niedermayer
2024-05-27 23:59 ` [FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() 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