diff mbox series

[FFmpeg-devel,2/7] tools/target_dem_fuzzer: Test interrupt callback

Message ID 20211205211907.30010-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/vivo: Do not use the general expression evaluator for parsing a floating point value
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Dec. 5, 2021, 9:19 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 tools/target_dem_fuzzer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c
index 3c03c8d17c0..6ee793a28ba 100644
--- a/tools/target_dem_fuzzer.c
+++ b/tools/target_dem_fuzzer.c
@@ -34,6 +34,13 @@  typedef struct IOContext {
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 
+int64_t interrupt_counter;
+static int interrupt_cb(void *ctx)
+{
+    interrupt_counter --;
+    return interrupt_counter < 0;
+}
+
 static void error(const char *err)
 {
     fprintf(stderr, "%s", err);
@@ -160,6 +167,9 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
                 *strchr(extension, ',') = 0;
             av_strlcatf(filename, sizeof(filename), ".%s", extension);
         }
+
+        interrupt_counter = bytestream2_get_le32(&gbc);
+        avfmt->interrupt_callback.callback = interrupt_cb;
     }
 
     if (!io_buffer_size || size / io_buffer_size > maxblocks)