LCOV - code coverage report
Current view: top level - waltz/h2 - fuzz_hpack_rd.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 7 7 100.0 %
Date: 2025-07-01 05:00: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 <assert.h>
       6             : #include <stdlib.h>
       7             : 
       8             : #include "fd_hpack.h"
       9             : #include "../../util/fd_util.h"
      10             : 
      11             : int
      12             : LLVMFuzzerInitialize( int  *   argc,
      13          15 :                       char *** argv ) {
      14             :   /* Set up shell without signal handlers */
      15          15 :   putenv( "FD_LOG_BACKTRACE=0" );
      16          15 :   fd_boot( argc, argv );
      17          15 :   atexit( fd_halt );
      18          15 :   fd_log_level_core_set(1); /* crash on info log */
      19          15 :   return 0;
      20          15 : }
      21             : 
      22             : int
      23             : LLVMFuzzerTestOneInput( uchar const * data,
      24             :                         ulong         size ) {
      25             :   fd_hpack_rd_t rd[1];
      26             :   fd_hpack_rd_init( rd, data, size );
      27             :   uchar const * prev = data;
      28             :   while( !fd_hpack_rd_done( rd ) ) {
      29             :     fd_h2_hdr_t hdr[1];
      30             :     uchar buf[ 128 ];
      31             :     uchar * bufp = buf;
      32             :     if( FD_UNLIKELY( fd_hpack_rd_next( rd, hdr, &bufp, buf+sizeof(buf) )!=FD_H2_SUCCESS ) ) break;
      33             :     /* FIXME validate content of hdr */
      34             :     assert( rd->src > prev ); /* must advance */
      35             :     assert( bufp>=buf && bufp<=buf+sizeof(buf) );
      36             :     prev = rd->src;
      37             :   }
      38             :   return 0;
      39             : }

Generated by: LCOV version 1.14