]> git.sesse.net Git - ffmpeg/commitdiff
dds: disable palette flag for compressed images
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Fri, 13 Nov 2015 20:48:27 +0000 (21:48 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Sat, 14 Nov 2015 02:40:20 +0000 (03:40 +0100)
Having both is not valid and can cause a NULL pointer dereference of
frame->data[1] later.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/dds.c

index ea58da0877e28096e27c56154d9ad2430cd383b7..3b7e7f67e99c6fea6924c1781194c01fea741310 100644 (file)
@@ -141,6 +141,12 @@ static int parse_pixel_format(AVCodecContext *avctx)
     normal_map      = flags & DDPF_NORMALMAP;
     fourcc = bytestream2_get_le32(gbc);
 
+    if (ctx->compressed && ctx->paletted) {
+        av_log(avctx, AV_LOG_WARNING,
+               "Disabling invalid palette flag for compressed dds.\n");
+        ctx->paletted = 0;
+    }
+
     bpp = bytestream2_get_le32(gbc); // rgbbitcount
     r   = bytestream2_get_le32(gbc); // rbitmask
     g   = bytestream2_get_le32(gbc); // gbitmask