]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bmp.c
avcodec/h261enc: More specific return code
[ffmpeg] / libavcodec / bmp.c
index 458fd0c768d481ea6c133b259341a95a0b3747ab..a35ed1ac1e355dd277f055cc62914f7f36444c88 100644 (file)
@@ -215,9 +215,13 @@ 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) {
-        av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
-               dsize, n * avctx->height);
-        return AVERROR_INVALIDDATA;
+        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