diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-24 01:01:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-08 09:44:35 +0200 |
commit | 694be24bd6c4cc9c62222f4583260bf79056e4c1 (patch) | |
tree | 2739d57b8f287cded3f01e1f6922e7408bb0e64f /libavcodec/qdm2.c | |
parent | ae021c1239ec3bc0a30dc5a4720569071599ece4 (diff) | |
download | ffmpeg-694be24bd6c4cc9c62222f4583260bf79056e4c1.tar.gz |
avcodec/qdm2: error out of qdm2_fft_decode_tones() before entering endless loop
Fixes: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'
Fixes: infinite loop
Fixes: 15396/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5116605501014016
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r-- | libavcodec/qdm2.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 44ff4fa6c6..1e91f477e8 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1289,6 +1289,10 @@ static void qdm2_fft_decode_tones(QDM2Context *q, int duration, } offset += (n - 2); } else { + if (local_int_10 <= 2) { + av_log(NULL, AV_LOG_ERROR, "qdm2_fft_decode_tones() stuck\n"); + return; + } offset += qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2); while (offset >= (local_int_10 - 1)) { offset += (1 - (local_int_10 - 1)); |