[FFmpeg-devel] [PATCH] avutil/imgutils: don't add offsets to NULL pointers

James Almer jamrial at gmail.com
Mon May 3 07:07:43 EEST 2021


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

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 53faad889a..aaee0dfb7a 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -166,7 +166,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
     }
 
     data[0] = ptr;
-    for (i = 1; i < 4 && sizes[i]; i++)
+    for (i = 1; i < 4 && data[i - 1] && sizes[i]; i++)
         data[i] = data[i - 1] + sizes[i - 1];
 
     return ret;
-- 
2.31.1



More information about the ffmpeg-devel mailing list