[FFmpeg-cvslog] tools/target_bsf_fuzzer: set bitstream filter options

James Almer git at videolan.org
Sat Nov 21 00:26:26 EET 2020


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Nov 14 22:14:24 2020 -0300| [c055a476b2498278861e938965852906407cc8e0] | committer: James Almer

tools/target_bsf_fuzzer: set bitstream filter options

Should increase coverage with some bitstream filters

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c055a476b2498278861e938965852906407cc8e0
---

 tools/target_bsf_fuzzer.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/target_bsf_fuzzer.c b/tools/target_bsf_fuzzer.c
index da8d62dd0b..8781a93ac3 100644
--- a/tools/target_bsf_fuzzer.c
+++ b/tools/target_bsf_fuzzer.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
 
 #include "libavcodec/avcodec.h"
 #include "libavcodec/bsf_internal.h"
@@ -66,6 +67,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
     if (size > 1024) {
         GetByteContext gbc;
         int extradata_size;
+        int flags;
         size -= 1024;
         bytestream2_init(&gbc, data + size, 1024);
         bsf->par_in->width                      = bytestream2_get_le32(&gbc);
@@ -88,6 +90,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
         bsf->par_in->block_align                = bytestream2_get_le32(&gbc);
         keyframes                               = bytestream2_get_le64(&gbc);
         flushpattern                            = bytestream2_get_le64(&gbc);
+        flags                                   = bytestream2_get_byte(&gbc);
+
+        if (flags & 0x20) {
+            if (!strcmp(f->name, "av1_metadata"))
+                av_opt_set_int(bsf->priv_data, "td", bytestream2_get_byte(&gbc) % 3, 0);
+            else if (!strcmp(f->name, "h264_metadata") || !strcmp(f->name, "h265_metadata"))
+                av_opt_set_int(bsf->priv_data, "aud", bytestream2_get_byte(&gbc) % 3, 0);
+            else if (!strcmp(f->name, "extract_extradata"))
+                av_opt_set_int(bsf->priv_data, "remove", bytestream2_get_byte(&gbc) & 1, 0);
+        }
 
         if (extradata_size < size) {
             bsf->par_in->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);



More information about the ffmpeg-cvslog mailing list