Coverage Report

Created: 2026-08-14 06:51

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libsndfile/ossfuzz/sndfile_fuzzer.cc
Line
Count
Source
1
#include <stdint.h>
2
#include <stdlib.h>
3
#include <string.h>
4
#include <sys/types.h>
5
#include <sndfile.h>
6
#include <inttypes.h>
7
8
#include "sndfile_fuzz_header.h"
9
10
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
11
16.9k
{  VIO_DATA vio_data ;
12
16.9k
   SF_VIRTUAL_IO vio ;
13
16.9k
   SF_INFO sndfile_info ;
14
16.9k
   SNDFILE *sndfile = NULL ;
15
16.9k
   float* read_buffer = NULL ;
16
17
16.9k
   int err = sf_init_file(data, size, &sndfile, &vio_data, &vio, &sndfile_info) ;
18
16.9k
   if (err)
19
14.0k
     goto EXIT_LABEL ;
20
21
   // Just the right number of channels. Create some buffer space for reading.
22
2.83k
   read_buffer = (float*)malloc(sizeof(float) * sndfile_info.channels);
23
2.83k
   if (read_buffer == NULL)
24
0
     abort() ;
25
26
190M
   while (sf_readf_float(sndfile, read_buffer, 1))
27
190M
   {
28
     // Do nothing with the data.
29
190M
   }
30
31
16.9k
EXIT_LABEL:
32
33
16.9k
   if (sndfile != NULL)
34
2.83k
     sf_close(sndfile) ;
35
36
16.9k
   free(read_buffer) ;
37
38
16.9k
   return 0 ;
39
2.83k
}