aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-06-05 02:33:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-18 01:16:04 +0200
commit7598b161f4ee88219be41caff09c219c83282b8d (patch)
tree2faecbe6e07f2f956e61631638c03b4ec6a5b25e /libavcodec
parentaa30aa8c136425a488eb9a059c6b8ca005f7bf48 (diff)
downloadffmpeg-7598b161f4ee88219be41caff09c219c83282b8d.tar.gz
avcodec/shorten: Check non COMM chunk len before skip in decode_aiff_header()
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 8024/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5109204648984576 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 424a81df107b63a166894a4aee3d27702ae3f459) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/shorten.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 49af6beec6..ae0cdfe09d 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -234,11 +234,11 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header,
while (bytestream2_get_le32(&gb) != MKTAG('C', 'O', 'M', 'M')) {
len = bytestream2_get_be32(&gb);
- bytestream2_skip(&gb, len + (len & 1));
- if (len < 0 || bytestream2_get_bytes_left(&gb) < 18) {
+ if (len < 0 || bytestream2_get_bytes_left(&gb) < 18LL + len + (len&1)) {
av_log(avctx, AV_LOG_ERROR, "no COMM chunk found\n");
return AVERROR_INVALIDDATA;
}
+ bytestream2_skip(&gb, len + (len & 1));
}
len = bytestream2_get_be32(&gb);