LCOV - code coverage report
Current view: top level - fuzz - fuzzer.c (source / functions) Coverage Total Hit
Test: Code coverage Lines: 100.0 % 16 16
Test Date: 2025-12-04 16:15:14 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 62.5 % 8 5

             Branch data     Line data    Source code
       1                 :             : /* Simpler gnu89 version of StandaloneFuzzTargetMain.c from LLVM */
       2                 :             : 
       3                 :             : #include <assert.h>
       4                 :             : #include <stdio.h>
       5                 :             : #include <stdlib.h>
       6                 :             : 
       7                 :             : int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size);
       8                 :             : __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
       9                 :             : 
      10                 :             : int
      11                 :           3 : main (int argc, char **argv)
      12                 :             : {
      13                 :             :     FILE *f;
      14                 :             :     size_t n_read, len;
      15                 :             :     unsigned char *buf;
      16                 :             : 
      17         [ +  - ]:           3 :     if (argc < 2) {
      18                 :             :         return 1;
      19                 :             :     }
      20                 :             : 
      21         [ +  + ]:           3 :     if (LLVMFuzzerInitialize) {
      22                 :           1 :         LLVMFuzzerInitialize(&argc, &argv);
      23                 :             :     }
      24                 :             : 
      25                 :           3 :     f = fopen (argv[1], "r");
      26         [ -  + ]:           3 :     assert (f);
      27                 :           3 :     fseek (f, 0, SEEK_END);
      28                 :           3 :     len = ftell (f);
      29                 :           3 :     fseek (f, 0, SEEK_SET);
      30                 :           3 :     buf = (unsigned char*) malloc (len);
      31                 :           3 :     n_read = fread (buf, 1, len, f);
      32         [ -  + ]:           3 :     assert (n_read == len);
      33                 :           3 :     LLVMFuzzerTestOneInput (buf, len);
      34                 :             : 
      35                 :           3 :     free (buf);
      36                 :           3 :     printf ("Done!\n");
      37                 :           3 :     return 0;
      38                 :             : }
        

Generated by: LCOV version 2.0-1