summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-15 16:41:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-15 16:46:51 +0100
commitc0d68be555f5858703383040e04fcd6529777061 (patch)
tree8ed6dfb5d04ddaacda587a4b7703517641959ef7
parentbc08ca841e66134a3b0d900cf152b4a263fa6545 (diff)
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>
-rw-r--r--libavcodec/pgssubdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 2876c6ac32..a303c08b80 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;