Coverage Report

Created: 2025-07-11 06:38

/src/compile_fuzzer.cc
Line
Count
Source
1
/* Copyright 2023 Google LLC
2
Licensed under the Apache License, Version 2.0 (the "License");
3
you may not use this file except in compliance with the License.
4
You may obtain a copy of the License at
5
      http://www.apache.org/licenses/LICENSE-2.0
6
Unless required by applicable law or agreed to in writing, software
7
distributed under the License is distributed on an "AS IS" BASIS,
8
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
See the License for the specific language governing permissions and
10
limitations under the License.
11
*/
12
#include "glslang/Public/ResourceLimits.h"
13
#include "glslang/Public/ShaderLang.h"
14
15
16
423
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
17
423
  glslang::InitializeProcess();
18
423
  EShMessages controls;
19
423
  glslang::TShader shader(EShLangVertex);
20
21
423
  const char *dataPtr = (const char*)data;
22
423
  const int dataSize = (const int)size;
23
24
423
  shader.setStringsWithLengths(&dataPtr, &dataSize, 1);
25
423
  shader.setEntryPoint("ep");
26
27
  // Parse the shader
28
423
  shader.parse(GetDefaultResources(), 100, false, controls);
29
30
423
  glslang::FinalizeProcess();
31
423
  return 0;
32
423
}