aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-20 18:08:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-21 17:02:19 +0100
commit7c17207ab9acfaa934e8feb8fba90765c9d0b989 (patch)
tree452edf10afb25415b3ff671f4e40c44085c59d91 /libavcodec
parent9847f02fafac16c1c3b72bad2f9bb5ccdd4d3678 (diff)
downloadffmpeg-7c17207ab9acfaa934e8feb8fba90765c9d0b989.tar.gz
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> (cherry picked from commit 6ba02602aa7fc7d38db582e75b8b093fb3c1608d) Conflicts: libavcodec/vmnc.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vmnc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index 99571a1b76..2cb48e619f 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -277,6 +277,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
}
xy = *src++;
wh = *src++;
+ 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);
}
}