summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-05-16 15:37:24 +0200
committerPaul B Mahol <onemda@gmail.com>2016-05-16 15:39:28 +0200
commit8767470fb572f394104d24acffb70eea9ce48ad3 (patch)
treefe2d58a58f952ba563b9f70125bb209b1ad5c29d /libavcodec/iff.c
parent635b2ec5f20d6cdef1adf4907ca28f8f09abcecc (diff)
downloadffmpeg-8767470fb572f394104d24acffb70eea9ce48ad3.tar.gz
avcodec/iff: check if there is enough bytes left
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index eef7ce18fd..85fae1589e 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -850,6 +850,9 @@ 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)
+ return;
+
if (kludge_j)
offset = ((offset / (320 / 8)) * pitch) + (offset % (320 / 8)) - kludge_j;
else
@@ -893,6 +896,9 @@ 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)
+ return;
+
for (b = 0; b < bytes; b++) {
uint8_t value = bytestream2_get_byte(&gb);