[vlc-commits] test: demux-libfuzzer: initialize libvlc only once

Thomas Guillem git at videolan.org
Sat Feb 23 10:17:05 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 20 18:40:08 2019 +0100| [aff97b8cd21887b0bcc121f0eec9afe74ce0850e] | committer: Thomas Guillem

test: demux-libfuzzer: initialize libvlc only once

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

 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;
 }



More information about the vlc-commits mailing list