diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 2eabf74274..2a047c0bb9 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -341,7 +341,7 @@ static int alloc_buffers(DiracContext *s, int stride) s->edge_emu_buffer_base = av_malloc_array(stride, MAX_BLOCKSIZE); - s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp)); + s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h + 5*MAX_BLOCKSIZE) * sizeof(*s->mctmp)); s->mcscratch = av_malloc_array(stride, MAX_BLOCKSIZE); if (!s->edge_emu_buffer_base || !s->mctmp || !s->mcscratch) @@ -1944,7 +1944,7 @@ static int dirac_decode_frame_internal(DiracContext *s) h = p->height - start; else h = p->ybsep - (start - dsty); - if (h < 0) + if (h <= 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight);