diff --git a/libavcodec/exr.c b/libavcodec/exr.c index e907c5c464..8b701d1cd2 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1830,7 +1830,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, // Zero out the start if ymin is not 0 for (i = 0; i < planes; i++) { ptr = picture->data[i]; - for (y = 0; y < s->ymin; y++) { + for (y = 0; y < FFMIN(s->ymin, s->h); y++) { memset(ptr, 0, out_line_size); ptr += picture->linesize[i]; }