* es/oss-fuzz: fuzz: port fuzz-url-decode-mem from OSS-Fuzz fuzz: port fuzz-parse-attr-line from OSS-Fuzz fuzz: port fuzz-credential-from-url-gently from OSS-Fuzz
···259 return git_attr_internal(name, strlen(name));
260}
261262-/* What does a matched pattern decide? */
263-struct attr_state {
264- const struct git_attr *attr;
265- const char *setto;
266-};
267-268-struct pattern {
269- const char *pattern;
270- int patternlen;
271- int nowildcardlen;
272- unsigned flags; /* PATTERN_FLAG_* */
273-};
274-275-/*
276- * One rule, as from a .gitattributes file.
277- *
278- * If is_macro is true, then u.attr is a pointer to the git_attr being
279- * defined.
280- *
281- * If is_macro is false, then u.pat is the filename pattern to which the
282- * rule applies.
283- *
284- * In either case, num_attr is the number of attributes affected by
285- * this rule, and state is an array listing them. The attributes are
286- * listed as they appear in the file (macros unexpanded).
287- */
288-struct match_attr {
289- union {
290- struct pattern pat;
291- const struct git_attr *attr;
292- } u;
293- char is_macro;
294- size_t num_attr;
295- struct attr_state state[FLEX_ARRAY];
296-};
297-298static const char blank[] = " \t\r\n";
299300/* Flags usable in read_attr() and parse_attr_line() family of functions. */
···353 return ep + strspn(ep, blank);
354}
355356-static struct match_attr *parse_attr_line(const char *line, const char *src,
357- int lineno, unsigned flags)
358{
359 size_t namelen, num_attr, i;
360 const char *cp, *name, *states;
···259 return git_attr_internal(name, strlen(name));
260}
261000000000000000000000000000000000000262static const char blank[] = " \t\r\n";
263264/* Flags usable in read_attr() and parse_attr_line() family of functions. */
···317 return ep + strspn(ep, blank);
318}
319320+struct match_attr *parse_attr_line(const char *line, const char *src,
321+ int lineno, unsigned flags)
322{
323 size_t namelen, num_attr, i;
324 const char *cp, *name, *states;
···240241extern char *git_attr_tree;
242243+/*
244+ * Exposed for fuzz-testing only.
245+ */
246+247+/* What does a matched pattern decide? */
248+struct attr_state {
249+ const struct git_attr *attr;
250+ const char *setto;
251+};
252+253+struct pattern {
254+ const char *pattern;
255+ int patternlen;
256+ int nowildcardlen;
257+ unsigned flags; /* PATTERN_FLAG_* */
258+};
259+260+/*
261+ * One rule, as from a .gitattributes file.
262+ *
263+ * If is_macro is true, then u.attr is a pointer to the git_attr being
264+ * defined.
265+ *
266+ * If is_macro is false, then u.pat is the filename pattern to which the
267+ * rule applies.
268+ *
269+ * In either case, num_attr is the number of attributes affected by
270+ * this rule, and state is an array listing them. The attributes are
271+ * listed as they appear in the file (macros unexpanded).
272+ */
273+struct match_attr {
274+ union {
275+ struct pattern pat;
276+ const struct git_attr *attr;
277+ } u;
278+ char is_macro;
279+ size_t num_attr;
280+ struct attr_state state[FLEX_ARRAY];
281+};
282+283+struct match_attr *parse_attr_line(const char *line, const char *src,
284+ int lineno, unsigned flags);
285+286#endif /* ATTR_H */
+12-1
ci/run-build-and-minimal-fuzzers.sh
···13 LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
14 fuzz-all
1516-for fuzzer in commit-graph config date pack-headers pack-idx ; do
0000000000017 begin_group "fuzz-$fuzzer"
18 ./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
19 end_group "fuzz-$fuzzer"