Coverage Report

Created: 2025-12-31 06:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tinyobjloader/fuzzer/fuzz_ParseFromString.cc
Line
Count
Source
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <stdint.h>
4
#include <stdarg.h>
5
#include <string.h>
6
7
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
8
#include "tiny_obj_loader.h"
9
10
40
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
11
40
    tinyobj::ObjReaderConfig reader_config;
12
40
    tinyobj::ObjReader reader;
13
40
    if (Size < 2) {
14
0
        return 0;
15
0
    }
16
16.5M
    for (size_t i = 0; i < Size-1; i++) {
17
16.5M
        if (Data[i] == 0) {
18
39
            std::string obj_text (reinterpret_cast<const char*>(Data), i);
19
39
            std::string mtl_text (reinterpret_cast<const char*>(Data+i+1), Size-i-1);
20
39
            reader.ParseFromString(obj_text, mtl_text,reader_config);
21
39
            return 0;
22
39
        }
23
16.5M
    }
24
1
    return 0;
25
40
}
26