Coverage Report

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