* 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
···259259 return git_attr_internal(name, strlen(name));
260260}
261261262262-/* What does a matched pattern decide? */
263263-struct attr_state {
264264- const struct git_attr *attr;
265265- const char *setto;
266266-};
267267-268268-struct pattern {
269269- const char *pattern;
270270- int patternlen;
271271- int nowildcardlen;
272272- unsigned flags; /* PATTERN_FLAG_* */
273273-};
274274-275275-/*
276276- * One rule, as from a .gitattributes file.
277277- *
278278- * If is_macro is true, then u.attr is a pointer to the git_attr being
279279- * defined.
280280- *
281281- * If is_macro is false, then u.pat is the filename pattern to which the
282282- * rule applies.
283283- *
284284- * In either case, num_attr is the number of attributes affected by
285285- * this rule, and state is an array listing them. The attributes are
286286- * listed as they appear in the file (macros unexpanded).
287287- */
288288-struct match_attr {
289289- union {
290290- struct pattern pat;
291291- const struct git_attr *attr;
292292- } u;
293293- char is_macro;
294294- size_t num_attr;
295295- struct attr_state state[FLEX_ARRAY];
296296-};
297297-298262static const char blank[] = " \t\r\n";
299263300264/* Flags usable in read_attr() and parse_attr_line() family of functions. */
···353317 return ep + strspn(ep, blank);
354318}
355319356356-static struct match_attr *parse_attr_line(const char *line, const char *src,
357357- int lineno, unsigned flags)
320320+struct match_attr *parse_attr_line(const char *line, const char *src,
321321+ int lineno, unsigned flags)
358322{
359323 size_t namelen, num_attr, i;
360324 const char *cp, *name, *states;
+43
attr.h
···240240241241extern char *git_attr_tree;
242242243243+/*
244244+ * Exposed for fuzz-testing only.
245245+ */
246246+247247+/* What does a matched pattern decide? */
248248+struct attr_state {
249249+ const struct git_attr *attr;
250250+ const char *setto;
251251+};
252252+253253+struct pattern {
254254+ const char *pattern;
255255+ int patternlen;
256256+ int nowildcardlen;
257257+ unsigned flags; /* PATTERN_FLAG_* */
258258+};
259259+260260+/*
261261+ * One rule, as from a .gitattributes file.
262262+ *
263263+ * If is_macro is true, then u.attr is a pointer to the git_attr being
264264+ * defined.
265265+ *
266266+ * If is_macro is false, then u.pat is the filename pattern to which the
267267+ * rule applies.
268268+ *
269269+ * In either case, num_attr is the number of attributes affected by
270270+ * this rule, and state is an array listing them. The attributes are
271271+ * listed as they appear in the file (macros unexpanded).
272272+ */
273273+struct match_attr {
274274+ union {
275275+ struct pattern pat;
276276+ const struct git_attr *attr;
277277+ } u;
278278+ char is_macro;
279279+ size_t num_attr;
280280+ struct attr_state state[FLEX_ARRAY];
281281+};
282282+283283+struct match_attr *parse_attr_line(const char *line, const char *src,
284284+ int lineno, unsigned flags);
285285+243286#endif /* ATTR_H */
+12-1
ci/run-build-and-minimal-fuzzers.sh
···1313 LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
1414 fuzz-all
15151616-for fuzzer in commit-graph config date pack-headers pack-idx ; do
1616+fuzzers="
1717+commit-graph
1818+config
1919+credential-from-url-gently
2020+date
2121+pack-headers
2222+pack-idx
2323+parse-attr-line
2424+url-decode-mem
2525+"
2626+2727+for fuzzer in $fuzzers; do
1728 begin_group "fuzz-$fuzzer"
1829 ./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
1930 end_group "fuzz-$fuzzer"