Coverage Report

Created: 2026-03-21 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/git/oss-fuzz/fuzz-parse-attr-line.c
Line
Count
Source
1
#define DISABLE_SIGN_COMPARE_WARNINGS
2
3
#include "git-compat-util.h"
4
#include <stddef.h>
5
#include <stdlib.h>
6
#include <stdint.h>
7
#include <string.h>
8
#include "attr.h"
9
10
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
11
12
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
13
910
{
14
910
  struct match_attr *res;
15
910
  char *buf;
16
17
910
  buf = malloc(size + 1);
18
910
  if (!buf)
19
0
    return 0;
20
21
910
  memcpy(buf, data, size);
22
910
  buf[size] = 0;
23
24
910
  res = parse_attr_line(buf, "dummy", 0, 0);
25
26
910
  if (res) {
27
696
    size_t j;
28
9.80k
    for (j = 0; j < res->num_attr; j++) {
29
9.11k
      const char *setto = res->state[j].setto;
30
9.11k
      if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
31
578
        ATTR_UNSET(setto))
32
8.74k
        ;
33
369
      else
34
369
        free((char *)setto);
35
9.11k
    }
36
696
    free(res);
37
696
  }
38
910
  free(buf);
39
40
910
  return 0;
41
910
}