From c0d68be555f5858703383040e04fcd6529777061 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 15 Nov 2012 16:41:28 +0100 Subject: [PATCH] pgssubdec: check RLE size before copying. Fix out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/pgssubdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 2876c6ac321..a303c08b802 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; -- 2.39.2