diracdec: fix edge emulation check, fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-11 03:34:09 +01:00
parent 991f6bf93d
commit dca2fa10d3
1 changed files with 2 additions and 2 deletions

View File

@ -1404,8 +1404,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
}
/* fixme: v/h _edge_pos */
if ((unsigned)x > p->width +EDGE_WIDTH/2 - p->xblen ||
(unsigned)y > p->height+EDGE_WIDTH/2 - p->yblen) {
if ((unsigned)x > FFMAX(p->width +EDGE_WIDTH/2 - p->xblen, 0) ||
(unsigned)y > FFMAX(p->height+EDGE_WIDTH/2 - p->yblen, 0)) {
for (i = 0; i < nplanes; i++) {
ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i], p->stride,
p->xblen, p->yblen, x, y,