[FFmpeg-cvslog] pgssubdec: check RLE size before copying. Fix out of array accesses

Michael Niedermayer git at videolan.org
Mon Dec 3 21:14:38 CET 2012


ffmpeg | branch: release/1.0 | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 15 16:41:28 2012 +0100| [28bf685bfc6d0c744369cdf367f61a78d80d0b01] | committer: Michael Niedermayer

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 at gmx.at>
(cherry picked from commit c0d68be555f5858703383040e04fcd6529777061)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28bf685bfc6d0c744369cdf367f61a78d80d0b01
---

 libavcodec/pgssubdec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 728f178..26a3c2a 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;
 



More information about the ffmpeg-cvslog mailing list