diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-10 17:25:46 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-12 21:01:48 +0200 |
commit | d40679d89c44fd9decc06d12a411007e73de1bd0 (patch) | |
tree | d65480fef128e6b993cfda80c156f5dac331ad90 /tools | |
parent | 86b485b5d68e20f8e804ee519463bce31da5417b (diff) | |
download | ffmpeg-d40679d89c44fd9decc06d12a411007e73de1bd0.tar.gz |
Add support for building fuzzer tools for an individual demuxer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 3 | ||||
-rw-r--r-- | tools/target_dem_fuzzer.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tools/Makefile b/tools/Makefile index 88d64ce6d2..48fa131eeb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,6 +8,9 @@ tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c $(COMPILE_C) -DFFMPEG_BSF=$* +tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c + $(COMPILE_C) -DFFMPEG_DEMUXER=$* -DIO_FLAT=0 + tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c $(COMPILE_C) -DIO_FLAT=1 diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c index eefb5c5fa3..79d572a6dc 100644 --- a/tools/target_dem_fuzzer.c +++ b/tools/target_dem_fuzzer.c @@ -103,8 +103,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { static int c; int seekable = 0; int ret; + AVInputFormat *fmt = NULL; if (!c) { +#ifdef FFMPEG_DEMUXER +#define DEMUXER_SYMBOL0(DEMUXER) ff_##DEMUXER##_demuxer +#define DEMUXER_SYMBOL(DEMUXER) DEMUXER_SYMBOL0(DEMUXER) + extern AVInputFormat DEMUXER_SYMBOL(FFMPEG_DEMUXER); + fmt = &DEMUXER_SYMBOL(FFMPEG_DEMUXER); +#endif av_register_all(); avcodec_register_all(); av_log_set_level(AV_LOG_PANIC); @@ -166,7 +173,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { avfmt->pb = fuzzed_pb; - ret = avformat_open_input(&avfmt, filename, NULL, NULL); + ret = avformat_open_input(&avfmt, filename, fmt, NULL); if (ret < 0) { av_freep(&fuzzed_pb->buffer); av_freep(&fuzzed_pb); |