diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index ec4c467049..458fd0c768 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -248,6 +248,8 @@ static int bmp_decode_frame(AVCodecContext *avctx, } else if (t) { colors = t; } + } else { + colors = FFMIN(256, (hsize-ihsize-14) / 3); } buf = buf0 + 14 + ihsize; //palette location // OS/2 bitmap, 3 bytes per palette entry