[FFmpeg-cvslog] dds: disable palette flag for compressed dds

Andreas Cadhalpun git at videolan.org
Sat Nov 14 22:12:14 CET 2015


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Fri Nov 13 21:48:27 2015 +0100| [603ebab8d7b789cd3cb6c7ca645a7badb5b950b4] | committer: Andreas Cadhalpun

dds: disable palette flag for compressed dds

Having both is not valid and can cause a NULL pointer dereference of
frame->data[1] later.

Reviewed-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=603ebab8d7b789cd3cb6c7ca645a7badb5b950b4
---

 libavcodec/dds.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index f04a4f5..d473fd1 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -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



More information about the ffmpeg-cvslog mailing list