Coverage Report

Created: 2023-06-07 06:38

/src/clib/test/fuzzing/fuzz_manifest.c
Line
Count
Source (jump to first uncovered line)
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdint.h>
5
#include "../../src/common/clib-package.h"
6
7
10
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
8
10
    if(size<3){
9
0
            return 0;
10
0
    }
11
10
    char filename[256];
12
10
    sprintf(filename, "libfuzzer.json");
13
14
10
    FILE *fp = fopen(filename, "wb");
15
10
    if (!fp)
16
0
            return 0;
17
10
    fwrite(data, size, 1, fp);
18
10
    fclose(fp);
19
    
20
10
    clib_package_t *pkg = 
21
10
      clib_package_load_from_manifest(filename, 0);
22
10
    if(pkg) {
23
4
      clib_package_free(pkg);
24
4
    }
25
10
    unlink(filename);
26
10
    return 0;
27
10
}