Skip to content

Commit aff97b8

Browse files
committed
test: demux-libfuzzer: initialize libvlc only once
1 parent 547a154 commit aff97b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: test/vlc-demux-libfuzzer.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,20 @@ int LLVMFuzzerInitialize(int *argc, char ***argv);
3737
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
3838

3939
static struct vlc_run_args args;
40+
static libvlc_instance_t *vlc;
4041

4142
int LLVMFuzzerInitialize(int *argc, char ***argv)
4243
{
4344
(void) argc; (void) argv;
4445

4546
vlc_run_args_init(&args);
47+
vlc = libvlc_create(&args);
4648

47-
return 0;
49+
return vlc ? 0 : -1;
4850
}
4951

5052
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
5153
{
52-
vlc_demux_process_memory(&args, data, size);
54+
libvlc_demux_process_memory(vlc, &args, data, size);
5355
return 0;
5456
}

0 commit comments

Comments
 (0)