summaryrefslogtreecommitdiff
path: root/libavcodec/dds.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-13 21:48:27 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-11-14 03:40:20 +0100
commit0a8bff788b0a9f96b863f0e836a235cb1d223f55 (patch)
tree225f4f820a1e46cca09ca96663e7956b9d397a69 /libavcodec/dds.c
parent2fb6e1e754f38ddd6eba0738f287e5b9ddc3777d (diff)
dds: disable palette flag for compressed images
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>
Diffstat (limited to 'libavcodec/dds.c')
-rw-r--r--libavcodec/dds.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index ea58da0877..3b7e7f67e9 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