diff mbox series

[FFmpeg-devel] avcodec/libaomdec: use intermediate arrays for plane pointers and strides

Message ID 20211030135754.413-1-jamrial@gmail.com
State Accepted
Commit 28fac45bde9fd38599a9c2896b58573d8e7303ff
Headers show
Series [FFmpeg-devel] avcodec/libaomdec: use intermediate arrays for plane pointers and strides | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

James Almer Oct. 30, 2021, 1:57 p.m. UTC
Fixes -Wstringop-overflow warnings with libaom >= 2.0.0, where the unused alpha
plane was removed from aom_image.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libaomdec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

James Zern Nov. 1, 2021, 5:46 p.m. UTC | #1
On Sat, Oct 30, 2021 at 6:59 AM James Almer <jamrial@gmail.com> wrote:
>
> Fixes -Wstringop-overflow warnings with libaom >= 2.0.0, where the unused alpha
> plane was removed from aom_image.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/libaomdec.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>

lgtm.
diff mbox series

Patch

diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 75ecc08970..e590c58d9d 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -224,9 +224,13 @@  static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame,
 
         if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
             image_copy_16_to_8(picture, img);
-        else
-            av_image_copy(picture->data, picture->linesize, (const uint8_t **)img->planes,
-                          img->stride, avctx->pix_fmt, img->d_w, img->d_h);
+        else {
+            const uint8_t *planes[4] = { img->planes[0], img->planes[1], img->planes[2] };
+            const int      stride[4] = { img->stride[0], img->stride[1], img->stride[2] };
+
+            av_image_copy(picture->data, picture->linesize, planes,
+                          stride, avctx->pix_fmt, img->d_w, img->d_h);
+        }
         *got_frame = 1;
     }
     return avpkt->size;