1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

Support BMP files that do not properly align lines.

Quite a few programs missed that detail of the spec
(including old versions of FFmpeg I believe) and when
we would otherwise fail anyway it seems worth a try
to use a simple byte-aligned stride instead.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
Reimar Döffinger 2015-01-26 20:19:17 +01:00
parent d3d4d98764
commit d96090e7b6

View File

@ -215,10 +215,14 @@ static int bmp_decode_frame(AVCodecContext *avctx,
n = ((avctx->width * depth + 31) / 8) & ~3;
if (n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8) {
n = (avctx->width * depth + 7) / 8;
if (n * avctx->height > dsize) {
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
dsize, n * avctx->height);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_ERROR, "data size too small, assuming missing line alignment\n");
}
// RLE may skip decoding some picture areas, so blank picture before decoding
if (comp == BMP_RLE4 || comp == BMP_RLE8)