aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-15 16:41:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-03 20:45:32 +0100
commit28bf685bfc6d0c744369cdf367f61a78d80d0b01 (patch)
treead8c54851c3afc3b12e30b5cbd3a23afa05b1b45
parentc51c5f83c13b0fa3e332e59bf764fdc598476b2e (diff)
downloadffmpeg-28bf685bfc6d0c744369cdf367f61a78d80d0b01.tar.gz
pgssubdec: check RLE size before copying. Fix out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit c0d68be555f5858703383040e04fcd6529777061)
-rw-r--r--libavcodec/pgssubdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 728f178ebd..26a3c2a2f7 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -222,6 +222,11 @@ static int parse_picture_segment(AVCodecContext *avctx,
return -1;
}
+ if (buf_size > rle_bitmap_len) {
+ av_log(avctx, AV_LOG_ERROR, "too much RLE data\n");
+ return AVERROR_INVALIDDATA;
+ }
+
ctx->pictures[picture_id].w = width;
ctx->pictures[picture_id].h = height;