summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-07-06 10:43:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-07-06 11:19:41 +0200
commitfcdbbbd85a16ce00198f53a21dbfdeea68412985 (patch)
tree2cbe7e7b8f86128fa4b19d0442085f66d3a7b762 /libavcodec/iff.c
parent3f5b7a2d73571379af13bd9a4f098193e216c6b0 (diff)
avcodec/iff: decode_delta_j: Check that the number of bytes that will be read are available
This should avoid long loops related to CID1361958 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index ef9ce9112f..677de0fb38 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -865,7 +865,7 @@ static void decode_delta_j(uint8_t *dst,
for (g = 0; g < groups; g++) {
offset = bytestream2_get_be16(&gb);
- if (bytestream2_get_bytes_left(&gb) < 1)
+ if (cols * bpp == 0 || bytestream2_get_bytes_left(&gb) < cols * bpp)
return;
if (kludge_j)
@@ -911,7 +911,7 @@ static void decode_delta_j(uint8_t *dst,
for (d = 0; d < bpp; d++) {
unsigned noffset = offset + (r * pitch) + d * planepitch;
- if (bytestream2_get_bytes_left(&gb) < 1)
+ if (!bytes || bytestream2_get_bytes_left(&gb) < bytes)
return;
for (b = 0; b < bytes; b++) {