[vlc-commits] [Git][videolan/vlc][master] test: vlc-demux-libfuzzer: read target from cmdline name

Thomas Guillem (@tguillem) gitlab at videolan.org
Sat Feb 15 14:11:20 UTC 2025



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
0405de26 by Thomas Guillem at 2025-02-15T13:57:31+00:00
test: vlc-demux-libfuzzer: read target from cmdline name

Work-arround oss-fuzz that can't accept scripts like the following:

```
export VLC_TARGET=$target
exec ./vlc-demux-dec-libfuzzer "\$@"
```

Therefore, append the target to the binary name.

cf. https://github.com/google/oss-fuzz/issues/1462#issuecomment-393362400

- - - - -


1 changed file:

- test/vlc-demux-libfuzzer.c


Changes:

=====================================
test/vlc-demux-libfuzzer.c
=====================================
@@ -41,9 +41,18 @@ static libvlc_instance_t *vlc;
 
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
-    (void) argc; (void) argv;
-
+    (void) argc;
     vlc_run_args_init(&args);
+
+    if (args.name == NULL)
+    {
+        char *name = *argv[0];
+        static const char suffix[] = "-libfuzzer";
+        static const size_t suffix_len = sizeof(suffix) - 1;
+        char *target_start = strstr(name, suffix);
+        if (target_start != NULL && target_start[suffix_len] == '-')
+            args.name = &target_start[suffix_len + 1];
+    }
     vlc = libvlc_create(&args);
 
     return vlc ? 0 : -1;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0405de26e21581d0f3d1a595bc18c5e8144f35ed

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0405de26e21581d0f3d1a595bc18c5e8144f35ed
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list