[FFmpeg-devel] [PATCH] tools/target_dec_fuzzer: set request_channel_layout

James Almer jamrial at gmail.com
Fri Dec 6 16:56:13 EET 2019


Should increase coverage of some decoders.

Signed-off-by: James Almer <jamrial at gmail.com>
---
Passing 6 to av_get_default_channel_layout() will return the 5.1 layout but
never 5.1(side), which is for example what the dts decoder actually looks for.
Any suggestion on how to make the fuzzer pick one of the non default layouts
using a given amount of channels?

 tools/target_dec_fuzzer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index dcf47b0f4d..fbfbbbc7ac 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -47,6 +47,7 @@
 
 #include "config.h"
 #include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 
@@ -207,6 +208,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
 
         ctx->sample_rate                        = bytestream2_get_le32(&gbc);
         ctx->channels                           = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
+        ctx->request_channel_layout             = av_get_default_channel_layout((unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS);
         ctx->block_align                        = bytestream2_get_le32(&gbc);
         ctx->codec_tag                          = bytestream2_get_le32(&gbc);
         keyframes                               = bytestream2_get_le64(&gbc);
-- 
2.24.0



More information about the ffmpeg-devel mailing list