[glib: 2/3] fuzzing: Only set the writer function once




commit 70e7161bc5ac584b771a74632a12ff98c5747f8b
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu May 5 16:32:27 2022 +0100

    fuzzing: Only set the writer function once
    
    This should fix fuzzing builds since commit dfb3517d.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    oss-fuzz#47108

 fuzzing/fuzz.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/fuzzing/fuzz.h b/fuzzing/fuzz.h
index 4a879984c0..5f999be0e8 100644
--- a/fuzzing/fuzz.h
+++ b/fuzzing/fuzz.h
@@ -17,6 +17,12 @@ static void
 fuzz_set_logging_func (void)
 {
 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
-  g_log_set_writer_func (empty_logging_func, NULL, NULL);
+  static gboolean writer_set = FALSE;
+
+  if (!writer_set)
+    {
+      g_log_set_writer_func (empty_logging_func, NULL, NULL);
+      writer_set = TRUE;
+    }
 #endif
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]