Commit ecf4e6b7 authored by James Almer's avatar James Almer

Merge commit 'd34a133b'

* commit 'd34a133b':
  dfa: Disallow odd width/height and add proper bounds check for DDS1 chunks
Merged-by: 's avatarJames Almer <jamrial@gmail.com>
parents e6d70494 d34a133b
......@@ -149,6 +149,8 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height
int mask = 0x10000, bitbuf = 0;
int i, v, offset, count, segments;
if ((width | height) & 1)
return AVERROR_INVALIDDATA;
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
......@@ -176,7 +178,7 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height
return AVERROR_INVALIDDATA;
frame += v;
} else {
if (frame_end - frame < width + 4)
if (width < 4 || frame_end - frame < width + 4)
return AVERROR_INVALIDDATA;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment