diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-07-01 02:34:33 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-07-01 02:34:33 +0200 |
commit | dec126a932c8dc0605054dc3be07791b629cc275 (patch) | |
tree | a709f1d5ca04de7ecb5c6c9d80cb23f3c09203ee | |
parent | a09918335f1305e2d6bf6a9b0001ac5f167c1aea (diff) | |
download | ffmpeg-dec126a932c8dc0605054dc3be07791b629cc275.tar.gz |
Fix internal buffer size for 2bpp and 4bpp raw video.
-rw-r--r-- | libavcodec/rawdec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 6644d6c7e4..d48cbed3e7 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -103,13 +103,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) } ff_set_systematic_pal2(context->palette, avctx->pix_fmt); - context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && avctx->pix_fmt==PIX_FMT_PAL8 && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ + context->length = avpicture_get_size(avctx->pix_fmt, (avctx->width+3)&~3, avctx->height); context->buffer = av_malloc(context->length); if (!context->buffer) return -1; + } else { + context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); } context->pic.pict_type = AV_PICTURE_TYPE_I; context->pic.key_frame = 1; |