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

Rémi Denis-Courmont remi at remlab.net
Thu Feb 21 09:13:19 CET 2019


If you want to retain the modules bank, you just need to keep *a* LibVLC instance active holding a reference to the bank.

You don't need to give that instance to the runner at all. And I don't think that's even desirable, as some demuxers probably alter the state of the LibVLC instance via VLC object variables or otherwise.

Le 20 février 2019 19:40:08 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>---
> 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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190221/bb0288fd/attachment.html>


More information about the vlc-devel mailing list