Browse Source

avcodec/vmnc: Check that rectangles are within the picture

Prevents out of array accesses with CODEC_FLAG_EMU_EDGE

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 11 years ago
parent
commit
6ba02602aa
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/vmnc.c

+ 5
- 0
libavcodec/vmnc.c View File

@@ -291,6 +291,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
fg = vmnc_get_pixel(gb, bpp, c->bigendian);
xy = bytestream2_get_byte(gb);
wh = bytestream2_get_byte(gb);
if ( (xy >> 4) + (wh >> 4) + 1 > w - i
|| (xy & 0xF) + (wh & 0xF)+1 > h - j) {
av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
return AVERROR_INVALIDDATA;
}
paint_rect(dst2, xy >> 4, xy & 0xF,
(wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
}


Loading…
Cancel
Save