Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /*  | 
2  |  |  * Copyright 2018 pdknsk  | 
3  |  |  *  | 
4  |  |  * SPDX-License-Identifier: LGPL-2.1-or-later  | 
5  |  |  *  | 
6  |  |  * This library is free software; you can redistribute it and/or  | 
7  |  |  * modify it under the terms of the GNU Lesser General Public  | 
8  |  |  * License as published by the Free Software Foundation; either  | 
9  |  |  * version 2.1 of the License, or (at your option) any later version.  | 
10  |  |  *  | 
11  |  |  * This library is distributed in the hope that it will be useful,  | 
12  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
13  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
14  |  |  * Lesser General Public License for more details.  | 
15  |  |  *  | 
16  |  |  * You should have received a copy of the GNU Lesser General Public  | 
17  |  |  * License along with this library; if not, see <http://www.gnu.org/licenses/>.  | 
18  |  |  */  | 
19  |  |  | 
20  |  | #include "gio/gio.h"  | 
21  |  | #include "glib/glib.h"  | 
22  |  |  | 
23  |  | int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size);  | 
24  |  |  | 
25  |  | #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION  | 
26  |  | static GLogWriterOutput  | 
27  |  | empty_logging_func (GLogLevelFlags log_level, const GLogField *fields,  | 
28  |  |                     gsize n_fields, gpointer user_data)  | 
29  | 0  | { | 
30  | 0  |   return G_LOG_WRITER_HANDLED;  | 
31  | 0  | }  | 
32  |  | #endif  | 
33  |  |  | 
34  |  | /* Disables logging for oss-fuzz. Must be used with each target. */  | 
35  |  | static void  | 
36  |  | fuzz_set_logging_func (void)  | 
37  | 1.18k  | { | 
38  | 1.18k  | #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION  | 
39  | 1.18k  |   static gboolean writer_set = FALSE;  | 
40  |  |  | 
41  | 1.18k  |   if (!writer_set)  | 
42  | 1  |     { | 
43  | 1  |       g_log_set_writer_func (empty_logging_func, NULL, NULL);  | 
44  | 1  |       writer_set = TRUE;  | 
45  | 1  |     }  | 
46  | 1.18k  | #endif  | 
47  | 1.18k  | }  |