LCOV - code coverage report
Current view: top level - ballet/toml - fuzz_toml.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 8 8 100.0 %
Date: 2024-11-13 11:58:15 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #if !FD_HAS_HOSTED
       2             : #error "This target requires FD_HAS_HOSTED"
       3             : #endif
       4             : 
       5             : #include <stdio.h>
       6             : #include <stdlib.h>
       7             : #include <unistd.h>
       8             : 
       9             : #include "../../util/fd_util.h"
      10             : #include "../../util/sanitize/fd_fuzz.h"
      11             : #include "fd_toml.h"
      12             : 
      13             : int
      14             : LLVMFuzzerInitialize( int  *   argc,
      15          18 :                       char *** argv ) {
      16             :   /* Set up shell without signal handlers */
      17          18 :   putenv( "FD_LOG_BACKTRACE=0" );
      18          18 :   fd_boot( argc, argv );
      19          18 :   atexit( fd_halt );
      20             : 
      21             :   /* Disable parsing error logging */
      22          18 :   fd_log_level_stderr_set(4);
      23          18 :   fd_log_level_logfile_set(4);
      24          18 :   return 0;
      25          18 : }
      26             : 
      27             : int
      28             : LLVMFuzzerTestOneInput( uchar const * data_,
      29             :                         ulong         size ) {
      30             :   char const * data = (char const *)data_;
      31             :   uchar scratch[128];
      32             :   uchar pod_data[256];
      33             :   uchar * pod = fd_pod_join( fd_pod_new( pod_data, sizeof(pod_data) ) );
      34             :   fd_toml_parse( data, size, pod, scratch, sizeof(scratch) );
      35             :   fd_pod_delete( fd_pod_leave( pod ) );
      36             :   return 0;
      37             : }

Generated by: LCOV version 1.14