diff mbox series

[FFmpeg-devel] avutil/imgutils: don't fill data pointers for missing planes

Message ID 20200724180813.38042-1-jamrial@gmail.com
State Accepted
Commit 5ce47d0aad31eff27a8626dd99774623f4d1b7a0
Headers show
Series [FFmpeg-devel] avutil/imgutils: don't fill data pointers for missing planes
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer July 24, 2020, 6:08 p.m. UTC
The size for a previous plane doesn't signal the presence of another after it.
If the plane is present, av_image_fill_plane_sizes() will have returned a size
for it.

Fixes a regression since 3a8e927176.

Reported-by: Imad R. Faiad <irfaiad@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/imgutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer July 26, 2020, 1:21 p.m. UTC | #1
On 7/24/2020 3:08 PM, James Almer wrote:
> The size for a previous plane doesn't signal the presence of another after it.
> If the plane is present, av_image_fill_plane_sizes() will have returned a size
> for it.
> 
> Fixes a regression since 3a8e927176.
> 
> Reported-by: Imad R. Faiad <irfaiad@gmail.com>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavutil/imgutils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
> index 4096c0da66..e592f7976a 100644
> --- a/libavutil/imgutils.c
> +++ b/libavutil/imgutils.c
> @@ -167,7 +167,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
>      memset(data , 0, sizeof(data[0])*4);
>  
>      data[0] = ptr;
> -    for (i = 1; i < 4 && sizes[i - 1] > 0; i++)
> +    for (i = 1; i < 4 && sizes[i]; i++)
>          data[i] = data[i - 1] + sizes[i - 1];
>  
>      return ret;

Will push soon.
diff mbox series

Patch

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 4096c0da66..e592f7976a 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -167,7 +167,7 @@  int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
     memset(data , 0, sizeof(data[0])*4);
 
     data[0] = ptr;
-    for (i = 1; i < 4 && sizes[i - 1] > 0; i++)
+    for (i = 1; i < 4 && sizes[i]; i++)
         data[i] = data[i - 1] + sizes[i - 1];
 
     return ret;