This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit e4c971d431880f28f3c6599f4083767c44838f72
Author: Boris Faure <[email protected]>
AuthorDate: Tue Nov 3 16:23:40 2026 +0000

    meson: build and run the colour parser fuzzer
    
    termiolink.c has had a libFuzzer entry point behind
    BINARY_TYFUZZ_COLOR_PARSER since 2020, but no build target was ever
    wired for it, so nothing exercised it. Build tyfuzz-color-parser when
    -Dfuzzing=true meets clang, the only toolchain shipping libFuzzer, and
    run it for 30 seconds as part of meson test, so the CI clang-release
    job fuzzes it on every push.
    
    meson's has_link_argument() cannot check -fsanitize=fuzzer: its probe
    defines main(), which conflicts with libFuzzer's own FuzzerMain.o,
    hence the clang toolchain check.
    
    The _is_authorized_in_color*() helpers are only used by the guarded
    half of the file; guard their definitions too, else the fuzzer build
    warns about unused functions.
---
 src/bin/meson.build  | 25 +++++++++++++++++++++++++
 src/bin/termiolink.c |  4 ++++
 2 files changed, 29 insertions(+)

diff --git a/src/bin/meson.build b/src/bin/meson.build
index db9f0ad0..283f5535 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -190,6 +190,31 @@ if fuzzing
              include_directories: config_dir,
              c_args: '-DBINARY_TYFUZZ=1',
              dependencies: terminology_dependencies)
+
+  # The colour-parser fuzzer wants libFuzzer, which ships with clang only,
+  # so the target only exists under clang. has_link_argument() cannot be
+  # used for -fsanitize=fuzzer: its probe has a main() that conflicts with
+  # libFuzzer's own FuzzerMain.o.
+  # termiolink.c compiled with BINARY_TYFUZZ_COLOR_PARSER drops the EFL
+  # parts of termio_color_find() and exposes LLVMFuzzerTestOneInput().
+  if cc.get_id() == 'clang' and cc.has_argument('-fsanitize=fuzzer-no-link')
+    tyfuzz_color_parser = executable('tyfuzz-color-parser',
+                                     ['termiolink.c', 'termiolink.h',
+                                      'sb.c', 'sb.h'],
+                                     install: false,
+                                     include_directories: config_dir,
+                                     c_args: ['-DBINARY_TYFUZZ_COLOR_PARSER=1',
+                                              '-fsanitize=fuzzer-no-link'],
+                                     link_args: ['-fsanitize=fuzzer'],
+                                     dependencies: terminology_dependencies)
+    # A short libFuzzer run, from scratch each time. No corpus directory is
+    # passed: which one exists and whether libFuzzer may create it varies
+    # across libFuzzer builds.
+    test('fuzz-color-parser', tyfuzz_color_parser,
+         args: ['-max_total_time=30', '-print_final_stats=1'],
+         timeout: 120,
+         suite: 'fuzzing')
+  endif
 endif
 if tests
   tytest = executable('tytest',
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 1a18a342..4c0e9f5c 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -684,6 +684,7 @@ end:
 }
 #endif
 
+#if !defined(BINARY_TYFUZZ_COLOR_PARSER)
 __attribute__((const))
 static Eina_Bool
 _is_authorized_in_color(const int codepoint)
@@ -734,6 +735,7 @@ _is_authorized_in_color(const int codepoint)
      }
    return EINA_FALSE;
 }
+#endif
 
 static Eina_Bool
 _parse_hex(const char c, uint8_t *v)
@@ -1253,6 +1255,7 @@ _parse_edc_color(struct ty_sb *sb,
    return EINA_TRUE;
 }
 
+#if !defined(BINARY_TYFUZZ_COLOR_PARSER)
 __attribute__((const))
 static Eina_Bool
 _is_authorized_in_color_sharp(const Eina_Unicode g)
@@ -1264,6 +1267,7 @@ _is_authorized_in_color_sharp(const Eina_Unicode g)
      return EINA_TRUE;
    return EINA_FALSE;
 }
+#endif
 
 static Eina_Bool
 _parse_color(struct ty_sb *sb,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to