Coverage Report

Created: 2025-07-18 06:25

/src/fuzz_cpuinfo.c
Line
Count
Source (jump to first uncovered line)
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
13
#include <fcntl.h>
14
#include <stdint.h>
15
#include <stdio.h>
16
#include <unistd.h>
17
18
#include <linux/api.h>
19
#include <x86/linux/api.h>
20
21
515
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
22
515
  char filename[256];
23
515
  sprintf(filename, "/tmp/libfuzzer.config");
24
25
515
  FILE *fp = fopen(filename, "wb");
26
515
  if (!fp) {
27
0
    return 0;
28
0
  }
29
515
  fwrite(data, size, 1, fp);
30
515
  fclose(fp);
31
32
515
  struct cpuinfo_x86_linux_processor processors[256];
33
515
  cpuinfo_x86_linux_parse_proc_cpuinfo(256, processors);
34
515
  cpuinfo_linux_get_max_processors_count();
35
36
515
  unlink(filename);
37
515
  return 0;
38
515
}