Commit 0f6d4da8 authored by Anton Khirnov's avatar Anton Khirnov Committed by Reinhard Tartler

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 8b78c296)
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 5c9d2d83
......@@ -217,9 +217,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];
......@@ -229,6 +226,9 @@ static int bmp_decode_frame(AVCodecContext *avctx,
}
if(avctx->pix_fmt == PIX_FMT_PAL8){
memset(p->data[1], 0, 1024);
buf = buf0 + 14 + ihsize; //palette location
if((hsize-ihsize-14)>>depth < 4){ // OS/2 bitmap, 3 bytes per palette entry
for(i = 0; i < (1 << depth); i++)
......
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