[vlc-devel] [PATCH 2/2] test: demux-libfuzzer: initialize libvlc only once

Thomas Guillem thomas at gllm.fr
Wed Feb 20 18:40:08 CET 2019


---
 test/vlc-demux-libfuzzer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/vlc-demux-libfuzzer.c b/test/vlc-demux-libfuzzer.c
index c7ec2a9b05..44995d147d 100644
--- a/test/vlc-demux-libfuzzer.c
+++ b/test/vlc-demux-libfuzzer.c
@@ -37,18 +37,20 @@ int LLVMFuzzerInitialize(int *argc, char ***argv);
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 
 static struct vlc_run_args args;
+static libvlc_instance_t *vlc;
 
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
     (void) argc; (void) argv;
 
     vlc_run_args_init(&args);
+    vlc = libvlc_create(&args);
 
-    return 0;
+    return vlc ? 0 : -1;
 }
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 {
-    vlc_demux_process_memory(&args, data, size);
+    libvlc_demux_process_memory(vlc, &args, data, size);
     return 0;
 }
-- 
2.20.1



More information about the vlc-devel mailing list