diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 14bb4b40e9..aec9505eb9 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1809,7 +1809,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, ptr = picture->data[0]; // Zero out the start if ymin is not 0 - 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[0]; }