diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-11-08 00:08:35 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:53:29 +0200 |
commit | 20b13122ec42398936f9e97c88b827792d583bc0 (patch) | |
tree | 3a7996d569ad0acabfd255c4c461320ab1fc4b79 | |
parent | 0dcc435972db32a7750ec7c456ec96e74cfa606e (diff) | |
download | ffmpeg-20b13122ec42398936f9e97c88b827792d583bc0.tar.gz |
avcodec/cfhd: check peak.offset
Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int'
Fixes: 26907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5746202330267648
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 386faeda5ff1924c17766248ce19528dbf90cf15)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/cfhd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 5f2cda8327..cbc16f8424 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -550,6 +550,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, s->peak.level = 0; } else if (tag == -74 && s->peak.offset) { s->peak.level = data; + if (s->peak.offset < 4 - bytestream2_tell(&s->peak.base) || + s->peak.offset > 4 + bytestream2_get_bytes_left(&s->peak.base) + ) { + ret = AVERROR_INVALIDDATA; + goto end; + } bytestream2_seek(&s->peak.base, s->peak.offset - 4, SEEK_CUR); } else av_log(avctx, AV_LOG_DEBUG, "Unknown tag %i data %x\n", tag, data); |