Coverage Report

Created: 2026-02-26 06:48

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
12.5k
{  VIO_DATA vio_data ;
12
12.5k
   SF_VIRTUAL_IO vio ;
13
12.5k
   SF_INFO sndfile_info ;
14
12.5k
   SNDFILE *sndfile = NULL ;
15
12.5k
   float* read_buffer = NULL ;
16
17
12.5k
   int err = sf_init_file(data, size, &sndfile, &vio_data, &vio, &sndfile_info) ;
18
12.5k
   if (err)
19
10.2k
     goto EXIT_LABEL ;
20
21
   // Just the right number of channels. Create some buffer space for reading.
22
2.24k
   read_buffer = (float*)malloc(sizeof(float) * sndfile_info.channels);
23
2.24k
   if (read_buffer == NULL)
24
0
     abort() ;
25
26
150M
   while (sf_readf_float(sndfile, read_buffer, 1))
27
150M
   {
28
     // Do nothing with the data.
29
150M
   }
30
31
12.5k
EXIT_LABEL:
32
33
12.5k
   if (sndfile != NULL)
34
2.24k
     sf_close(sndfile) ;
35
36
12.5k
   free(read_buffer) ;
37
38
12.5k
   return 0 ;
39
2.24k
}