summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <[email protected]>2012-09-16 08:33:09 +0200
committerReinhard Tartler <[email protected]>2013-02-10 18:01:15 +0100
commit0f6d4da8def2c697b2512a12285a227ec7d5bb9b (patch)
treedf289aeac63eb246e14e0673d35ac3570e807712
parent5c9d2d837783b636fb0f923709a2554bbc1a49dd (diff)
bmpdec: only initialize palette for pal8.
Gray8 is not considered to be paletted, so this would cause an invalid write. Fixes bug 367. CC: [email protected] (cherry picked from commit 8b78c2969a5b7dca939d93bf525aa2bcd737b5d9) Signed-off-by: Anton Khirnov <[email protected]>
-rw-r--r--libavcodec/bmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index 14c070da8f..30bae8c7d0 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -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++)