mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
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 386faeda5f
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
9e1fede231
commit
28df673d7d
@ -611,6 +611,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);
|
||||
|
Loading…
Reference in New Issue
Block a user