mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'd34a133b78afe2793cd8537f3c7f42437f441e94'
* commit 'd34a133b78afe2793cd8537f3c7f42437f441e94': dfa: Disallow odd width/height and add proper bounds check for DDS1 chunks Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
commit
ecf4e6b720
@ -149,6 +149,8 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height
|
|||||||
int mask = 0x10000, bitbuf = 0;
|
int mask = 0x10000, bitbuf = 0;
|
||||||
int i, v, offset, count, segments;
|
int i, v, offset, count, segments;
|
||||||
|
|
||||||
|
if ((width | height) & 1)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
segments = bytestream2_get_le16(gb);
|
segments = bytestream2_get_le16(gb);
|
||||||
while (segments--) {
|
while (segments--) {
|
||||||
if (bytestream2_get_bytes_left(gb) < 2)
|
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;
|
return AVERROR_INVALIDDATA;
|
||||||
frame += v;
|
frame += v;
|
||||||
} else {
|
} else {
|
||||||
if (frame_end - frame < width + 4)
|
if (width < 4 || frame_end - frame < width + 4)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
frame[0] = frame[1] =
|
frame[0] = frame[1] =
|
||||||
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
|
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
|
||||||
|
Loading…
Reference in New Issue
Block a user