diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-09-16 08:33:09 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-09-28 08:04:43 +0200 |
commit | bed5847563d1b9d3ee284f1fae442199508c7492 (patch) | |
tree | d0b4730ca868b25943dd8ce252bbc2b51f027931 | |
parent | e9ac06160f4550c339dbd1a30a6c6925a7a17dbd (diff) | |
download | ffmpeg-bed5847563d1b9d3ee284f1fae442199508c7492.tar.gz |
bmpdec: only initialize palette for pal8.
Gray8 is not considered to be paletted, so this would cause an invalid
write.
Fixes bug 367.
CC: libav-stable@libav.org
(cherry picked from commit 8b78c2969a5b7dca939d93bf525aa2bcd737b5d9)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavcodec/bmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 1f725f5369..974db4953c 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -227,9 +227,6 @@ static int bmp_decode_frame(AVCodecContext *avctx, if(comp == BMP_RLE4 || comp == BMP_RLE8) memset(p->data[0], 0, avctx->height * p->linesize[0]); - if(depth == 4 || depth == 8) - memset(p->data[1], 0, 1024); - if(height > 0){ ptr = p->data[0] + (avctx->height - 1) * p->linesize[0]; linesize = -p->linesize[0]; @@ -240,6 +237,9 @@ static int bmp_decode_frame(AVCodecContext *avctx, if(avctx->pix_fmt == PIX_FMT_PAL8){ int colors = 1 << depth; + + memset(p->data[1], 0, 1024); + if(ihsize >= 36){ int t; buf = buf0 + 46; |