tools/target_dec_fuzzer: Stop negative block_align and sampling rate
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 28 Dec 2019 19:16:24 +0000 (20:16 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 31 Dec 2019 11:37:47 +0000 (12:37 +0100)
These are checked for early in avcodec_open2() and do not really test the decoder
but instead waste resources which could be better spend fuzzing the actual decoder

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tools/target_dec_fuzzer.c

index c232f6d..2d9d28b 100644 (file)
@@ -206,9 +206,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
 
         extradata_size = bytestream2_get_le32(&gbc);
 
 
         extradata_size = bytestream2_get_le32(&gbc);
 
-        ctx->sample_rate                        = bytestream2_get_le32(&gbc);
+        ctx->sample_rate                        = bytestream2_get_le32(&gbc) & 0x7FFFFFFF;
         ctx->channels                           = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
         ctx->channels                           = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
-        ctx->block_align                        = bytestream2_get_le32(&gbc);
+        ctx->block_align                        = bytestream2_get_le32(&gbc) & 0x7FFFFFFF;
         ctx->codec_tag                          = bytestream2_get_le32(&gbc);
         keyframes                               = bytestream2_get_le64(&gbc);
         ctx->request_channel_layout             = bytestream2_get_le64(&gbc);
         ctx->codec_tag                          = bytestream2_get_le32(&gbc);
         keyframes                               = bytestream2_get_le64(&gbc);
         ctx->request_channel_layout             = bytestream2_get_le64(&gbc);