Coverage Report

Created: 2025-07-11 06:48

/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
510
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
22
510
  char filename[256];
23
510
  sprintf(filename, "/tmp/libfuzzer.config");
24
25
510
  FILE *fp = fopen(filename, "wb");
26
510
  if (!fp) {
27
0
    return 0;
28
0
  }
29
510
  fwrite(data, size, 1, fp);
30
510
  fclose(fp);
31
32
510
  struct cpuinfo_x86_linux_processor processors[256];
33
510
  cpuinfo_x86_linux_parse_proc_cpuinfo(256, processors);
34
510
  cpuinfo_linux_get_max_processors_count();
35
36
510
  unlink(filename);
37
510
  return 0;
38
510
}