LCOV - code coverage report
Current view: top level - util/archive - fuzz_ar.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 7 7 100.0 %
Date: 2025-08-05 05:04:49 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             : 
       8             : #include "../../util/fd_util.h"
       9             : #include "../../util/sanitize/fd_fuzz.h"
      10             : #include "fd_ar.h"
      11             : 
      12             : int
      13             : LLVMFuzzerInitialize( int  *   argc,
      14          12 :                       char *** argv ) {
      15             :   /* Set up shell without signal handlers */
      16          12 :   putenv( "FD_LOG_BACKTRACE=0" );
      17          12 :   fd_boot( argc, argv );
      18          12 :   atexit( fd_halt );
      19          12 :   fd_log_level_stderr_set( 4 );
      20          12 :   return 0;
      21          12 : }
      22             : 
      23             : int
      24             : LLVMFuzzerTestOneInput( uchar const * data,
      25             :                         ulong         size ) {
      26             :   FILE * file = fmemopen( (void *)data, size, "r" );
      27             :   FD_TEST( file );
      28             : 
      29             :   fd_ar_read_init( file );
      30             : 
      31             :   fd_ar_meta_t meta[1];
      32             :   for( int i=0; i<8; i++ ) {
      33             :     fd_ar_read_next( file, meta );
      34             :   }
      35             : 
      36             :   FD_TEST( !fclose( file ) );
      37             :   return 0;
      38             : }

Generated by: LCOV version 1.14