aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/libavcodec/msrledec.c
diff options
context:
space:
mode:
authorelupus <elupus@xbmc.org>2012-03-25 23:27:29 +0200
committerelupus <elupus@xbmc.org>2012-03-31 16:28:00 +0200
commit2836f95ad7d9425fc27c2de62b5c51e7829032f6 (patch)
tree158a931d0795a3c9d9e21294ac9f1fa63e03f17f /lib/ffmpeg/libavcodec/msrledec.c
parent8a0ce9e337267786236cba4f68d1db93bd28c3ef (diff)
Update ffmpeg to n0.10.2 (f139838d6473c7b5152178f602cb953a824c2ff9)
xbmc ffmpeg 05f8b5549c5e20cf9a417069838edd6841d7bd40
Diffstat (limited to 'lib/ffmpeg/libavcodec/msrledec.c')
-rw-r--r--lib/ffmpeg/libavcodec/msrledec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ffmpeg/libavcodec/msrledec.c b/lib/ffmpeg/libavcodec/msrledec.c
index 97510830d5..129f0e0bc0 100644
--- a/lib/ffmpeg/libavcodec/msrledec.c
+++ b/lib/ffmpeg/libavcodec/msrledec.c
@@ -138,9 +138,9 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
uint32_t av_uninit(pix32);
unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3);
- output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
- output_end = pic->data[0] + (avctx->height) * pic->linesize[0];
- while(src < data + srcsize) {
+ output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
+ output_end = pic->data[0] + avctx->height * pic->linesize[0];
+ while(src + 1 < data + srcsize) {
p1 = *src++;
if(p1 == 0) { //Escape code
p2 = *src++;
@@ -172,6 +172,10 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
src += p2 * (depth >> 3);
continue;
}
+ if(data + srcsize - src < p2 * (depth >> 3)){
+ av_log(avctx, AV_LOG_ERROR, "Copy beyond input buffer\n");
+ return -1;
+ }
if ((depth == 8) || (depth == 24)) {
for(i = 0; i < p2 * (depth >> 3); i++) {
*output++ = *src++;