[FFmpeg-devel] [PATCH v3 4/4] libavutil/imgutils: check for non-null buffer in av_image_fill_pointers
Brian Kim
bkkim at google.com
Mon Jul 13 20:09:40 EEST 2020
We were previously always filling data by adding offsets to ptr, which
was undefined behavior when ptr was NULL.
Signed-off-by: Brian Kim <bkkim at google.com>
---
libavutil/imgutils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 345b7fa94c..721dc2784a 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -166,6 +166,9 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
memset(data , 0, sizeof(data[0])*4);
+ if (!ptr)
+ return ret;
+
data[0] = ptr;
for (i = 1; i < 4 && sizes[i - 1] > 0; i++)
data[i] = data[i - 1] + sizes[i - 1];
--
2.27.0.389.gc38d7665816-goog
More information about the ffmpeg-devel
mailing list