Commit 7db3a46a authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'd98e6c5d'

* commit 'd98e6c5d':
  pgssubdec: Check RLE size before copying

See: c0d68be5Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents d76675d9 d98e6c5d
...@@ -278,6 +278,13 @@ static int parse_object_segment(AVCodecContext *avctx, ...@@ -278,6 +278,13 @@ static int parse_object_segment(AVCodecContext *avctx,
/* Decode rle bitmap length, stored size includes width/height data */ /* Decode rle bitmap length, stored size includes width/height data */
rle_bitmap_len = bytestream_get_be24(&buf) - 2*2; 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 */ /* Get bitmap dimensions from data */
width = bytestream_get_be16(&buf); width = bytestream_get_be16(&buf);
height = bytestream_get_be16(&buf); height = bytestream_get_be16(&buf);
...@@ -288,11 +295,6 @@ static int parse_object_segment(AVCodecContext *avctx, ...@@ -288,11 +295,6 @@ static int parse_object_segment(AVCodecContext *avctx,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (buf_size > rle_bitmap_len) {
av_log(avctx, AV_LOG_ERROR, "too much RLE data\n");
return AVERROR_INVALIDDATA;
}
object->w = width; object->w = width;
object->h = height; object->h = height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment