1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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
This commit is contained in:
Anton Khirnov 2012-09-16 08:33:09 +02:00
parent 1c9d54b468
commit 8b78c2969a

View File

@ -228,9 +228,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
if(comp == BMP_RLE4 || comp == BMP_RLE8) if(comp == BMP_RLE4 || comp == BMP_RLE8)
memset(p->data[0], 0, avctx->height * p->linesize[0]); memset(p->data[0], 0, avctx->height * p->linesize[0]);
if(depth == 4 || depth == 8)
memset(p->data[1], 0, 1024);
if(height > 0){ if(height > 0){
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0]; ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
linesize = -p->linesize[0]; linesize = -p->linesize[0];
@ -241,6 +238,9 @@ static int bmp_decode_frame(AVCodecContext *avctx,
if(avctx->pix_fmt == PIX_FMT_PAL8){ if(avctx->pix_fmt == PIX_FMT_PAL8){
int colors = 1 << depth; int colors = 1 << depth;
memset(p->data[1], 0, 1024);
if(ihsize >= 36){ if(ihsize >= 36){
int t; int t;
buf = buf0 + 46; buf = buf0 + 46;