diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-08 16:19:24 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-08 16:20:41 +0400 |
commit | 1ee5e2ce3d6d28d0e2999afe073bc00ddb96c171 (patch) | |
tree | c178473e29845678bdc86a8c1a40818aba335ddd | |
parent | 6e83c266201adb15971bc3ad5c6c41fedace08ac (diff) | |
parent | 00915d3cd2ce61db3d6dc11f63566630a9aff4ec (diff) |
Merge commit '00915d3cd2ce61db3d6dc11f63566630a9aff4ec' into release/1.1
* commit '00915d3cd2ce61db3d6dc11f63566630a9aff4ec':
pgssubdec: Check RLE size before copying
See: c0d68be555f5858703383040e04fcd6529777061
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/pgssubdec.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index d0cff7bba6..699876bcd6 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -212,6 +212,13 @@ static int parse_picture_segment(AVCodecContext *avctx, /* Decode rle bitmap length, stored size includes width/height data */ rle_bitmap_len = bytestream_get_be24(&buf) - 2*2; + if (buf_size > rle_bitmap_len) { + av_log(avctx, AV_LOG_ERROR, + "Buffer dimension %d larger than the expected RLE data %d\n", + buf_size, rle_bitmap_len); + return AVERROR_INVALIDDATA; + } + /* Get bitmap dimensions from data */ width = bytestream_get_be16(&buf); height = bytestream_get_be16(&buf); @@ -222,11 +229,6 @@ 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; |