
Start working to make the codebase buildable with -Wsign-compare. * ps/build-sign-compare: t/helper: don't depend on implicit wraparound scalar: address -Wsign-compare warnings builtin/patch-id: fix type of `get_one_patchid()` builtin/blame: fix type of `length` variable when emitting object ID gpg-interface: address -Wsign-comparison warnings daemon: fix type of `max_connections` daemon: fix loops that have mismatching integer types global: trivial conversions to fix `-Wsign-compare` warnings pkt-line: fix -Wsign-compare warning on 32 bit platform csum-file: fix -Wsign-compare warning on 32-bit platform diff.h: fix index used to loop through unsigned integer config.mak.dev: drop `-Wno-sign-compare` global: mark code units that generate warnings with `-Wsign-compare` compat/win32: fix -Wsign-compare warning in "wWinMain()" compat/regex: explicitly ignore "-Wsign-compare" warnings git-compat-util: introduce macros to disable "-Wsign-compare" warnings
42 lines
729 B
C
42 lines
729 B
C
#define DISABLE_SIGN_COMPARE_WARNINGS
|
|
|
|
#include "git-compat-util.h"
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include "attr.h"
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|
{
|
|
struct match_attr *res;
|
|
char *buf;
|
|
|
|
buf = malloc(size + 1);
|
|
if (!buf)
|
|
return 0;
|
|
|
|
memcpy(buf, data, size);
|
|
buf[size] = 0;
|
|
|
|
res = parse_attr_line(buf, "dummy", 0, 0);
|
|
|
|
if (res) {
|
|
int j;
|
|
for (j = 0; j < res->num_attr; j++) {
|
|
const char *setto = res->state[j].setto;
|
|
if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
|
|
ATTR_UNSET(setto))
|
|
;
|
|
else
|
|
free((char *)setto);
|
|
}
|
|
free(res);
|
|
}
|
|
free(buf);
|
|
|
|
return 0;
|
|
}
|