diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-09 23:23:16 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-27 00:28:07 +0100 |
commit | 9b506280dd9b95b944676316ae3f8ea5605a7a10 (patch) | |
tree | 49994a44afa05cd448566e9ee65f40c5827c1455 | |
parent | 312757eb848b96bcc1e0df17312b11a24c4f18d3 (diff) | |
download | ffmpeg-9b506280dd9b95b944676316ae3f8ea5605a7a10.tar.gz |
pgssubdec: only set w/h/linesize when allocating data
Rects with positive w/h/linesize but no data are invalid.
Reviewed-by: Petri Hintukainen <phintuka@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 995512328ed84bb737bc364e4ef6fba1994f062a)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavcodec/pgssubdec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index cef477d8c2..b50b37b206 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -556,12 +556,13 @@ static int display_end_segment(AVCodecContext *avctx, void *data, sub->rects[i]->x = ctx->presentation.objects[i].x; sub->rects[i]->y = ctx->presentation.objects[i].y; - sub->rects[i]->w = object->w; - sub->rects[i]->h = object->h; - - sub->rects[i]->linesize[0] = object->w; if (object->rle) { + sub->rects[i]->w = object->w; + sub->rects[i]->h = object->h; + + sub->rects[i]->linesize[0] = object->w; + if (object->rle_remaining_len) { av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n", object->rle_data_len, object->rle_remaining_len); |