diff mbox

[FFmpeg-devel] dds: limit 4 bpp handling to AV_PIX_FMT_PAL8

Message ID 6f222917-50fa-0b17-7255-49af2e0fa7a2@googlemail.com
State Accepted
Commit 90ebf3c428352eb1d4116bf97b470ceca295d7d6
Headers show

Commit Message

Andreas Cadhalpun Nov. 15, 2016, 9:18 p.m. UTC
This fixes NULL pointer dereferencing for formats, where frame->data[1]
is not allocated.

The problem was introduced in commit
257fbc3af4cba08ac471dab68924182160bde6fd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavcodec/dds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Cadhalpun Nov. 16, 2016, 6:41 p.m. UTC | #1
On 16.11.2016 07:52, Paul B Mahol wrote:
> On 11/15/16, Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote:
>> This fixes NULL pointer dereferencing for formats, where frame->data[1]
>> is not allocated.
>>
>> The problem was introduced in commit
>> 257fbc3af4cba08ac471dab68924182160bde6fd.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>> ---
>>  libavcodec/dds.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/dds.c b/libavcodec/dds.c
>> index 43319a8..fa0f34d 100644
>> --- a/libavcodec/dds.c
>> +++ b/libavcodec/dds.c
>> @@ -680,7 +680,7 @@ static int dds_decode(AVCodecContext *avctx, void
>> *data,
>>          /* Use the decompress function on the texture, one block per
>> thread. */
>>          ctx->tex_data = gbc->buffer;
>>          avctx->execute2(avctx, decompress_texture_thread, frame, NULL,
>> ctx->slice_count);
>> -    } else if (!ctx->paletted && ctx->bpp == 4) {
>> +    } else if (!ctx->paletted && ctx->bpp == 4 && avctx->pix_fmt ==
>> AV_PIX_FMT_PAL8) {
>>          uint8_t *dst = frame->data[0];
>>          int x, y, i;
>>
>> --
>> 2.10.2
>>
> 
> ok

Pushed.

Best regards,
Andreas
diff mbox

Patch

diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 43319a8..fa0f34d 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -680,7 +680,7 @@  static int dds_decode(AVCodecContext *avctx, void *data,
         /* Use the decompress function on the texture, one block per thread. */
         ctx->tex_data = gbc->buffer;
         avctx->execute2(avctx, decompress_texture_thread, frame, NULL, ctx->slice_count);
-    } else if (!ctx->paletted && ctx->bpp == 4) {
+    } else if (!ctx->paletted && ctx->bpp == 4 && avctx->pix_fmt == AV_PIX_FMT_PAL8) {
         uint8_t *dst = frame->data[0];
         int x, y, i;