[FFmpeg-devel,8/8] avcodec/qdm2: The smallest header seems to have 2 bytes so treat 1 as invalid

Submitted by Michael Niedermayer on Oct. 31, 2019, 5:58 p.m.

Details

Message ID 20191031175830.24895-8-michael@niedermayer.cc
State Accepted
Commit e36ccb5048f052b8b2ef08281cb607fa53a7b7e4
Headers show

Commit Message

Michael Niedermayer Oct. 31, 2019, 5:58 p.m.
Fixes: Timeout (217sec -> 2ms)
Fixes: 18488/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5708293662310400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/qdm2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 20, 2019, 2:07 p.m.
On Thu, Oct 31, 2019 at 06:58:30PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (217sec -> 2ms)
> Fixes: 18488/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5708293662310400
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/qdm2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index ac8ae8cbbb..7b9d50b234 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1704,7 +1704,7 @@  static av_cold int qdm2_decode_init(AVCodecContext *avctx)
     s->group_size = bytestream2_get_be32(&gb);
     s->fft_size = bytestream2_get_be32(&gb);
     s->checksum_size = bytestream2_get_be32(&gb);
-    if (s->checksum_size >= 1U << 28 || !s->checksum_size) {
+    if (s->checksum_size >= 1U << 28 || s->checksum_size <= 1) {
         av_log(avctx, AV_LOG_ERROR, "data block size invalid (%u)\n", s->checksum_size);
         return AVERROR_INVALIDDATA;
     }