diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 0cff34123c..b946d6dc0c 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -276,6 +276,10 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], for (i = 0; i < planes_nb; i++) { int h = height; int bwidth = av_image_get_linesize(pix_fmt, width, i); + if (bwidth < 0) { + av_log(0, AV_LOG_ERROR, "av_image_get_linesize failed\n"); + return; + } if (i == 1 || i == 2) { h= -((-height)>>desc->log2_chroma_h); }