LCOV - code coverage report
Current view: top level - discof/restore/utils - fuzz_ssarchive_parser.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 8 8 100.0 %
Date: 2025-09-19 04:41:14 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "fd_ssarchive.h"
       2             : 
       3             : #if !FD_HAS_HOSTED
       4             : #error "This target requires FD_HAS_HOSTED"
       5             : #endif
       6             : 
       7             : #include <stdlib.h>
       8             : #include <assert.h>
       9             : 
      10             : int
      11             : LLVMFuzzerInitialize( int  *   argc,
      12          12 :                       char *** argv ) {
      13             :   /* Set up shell without signal handlers */
      14          12 :   putenv( "FD_LOG_BACKTRACE=0" );
      15          12 :   fd_boot( argc, argv );
      16          12 :   atexit( fd_halt );
      17          12 :   fd_log_level_core_set   ( 4 );
      18          12 :   fd_log_level_logfile_set( 4 );
      19             : 
      20          12 :   return 0;
      21          12 : }
      22             : 
      23             : int
      24             : LLVMFuzzerTestOneInput( uchar const * data,
      25             :                         ulong         size ) {
      26             :   ulong full_slot;
      27             :   ulong incremental_slot;
      28             :   uchar decoded_hash[ FD_HASH_FOOTPRINT ];
      29             : 
      30             :   char* name_cstr = (char *)malloc( size + 1UL );
      31             :   assert( name_cstr );
      32             :   fd_cstr_fini( fd_cstr_append_text( fd_cstr_init( name_cstr ), (char const *)data, size ) );
      33             : 
      34             :   fd_ssarchive_parse_filename( name_cstr, &full_slot, &incremental_slot, decoded_hash );
      35             : 
      36             :   free( name_cstr );
      37             :   return 0;
      38             : }

Generated by: LCOV version 1.14