git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/3] fuzz: port OSS-Fuzz tests back to Git

From
Josh Steadmon <steadmon@google.com>
Date
Oct 14, 2024, 21:04 UTC
Message-ID
<cover.1728939687.git.steadmon@google.com>
In-Reply-To
<cover.1728594659.git.steadmon@google.com>

Git's fuzz tests are run continuously as part of OSS-Fuzz [1]. Several additional fuzz tests have been contributed directly to OSS-Fuzz; however, these tests are vulnerable to bitrot because they are not built during Git's CI runs, and thus breaking changes are much less likely to be noticed by Git contributors.

OSS-Fuzz's recommended setup is for tests to live in the repository of the code they test and to be built along with other tests [1].

Port some of these tests back to the Git project, so that they can be built and tested during our normal development workflow and CI, and as such avoid future bitrot.

[1] https://google.github.io/oss-fuzz/advanced-topics/ideal-integration/
Changes in V2:
* Remove an errant `echo` in ci/run-build-and-minimal-fuzzers.sh
* Fix some style nits in ci/run-build-and-minimal-fuzzers.sh
* Fix whitespace errors in attr.{h,c}
Eric Sesterhenn (3):
  fuzz: port fuzz-credential-from-url-gently from OSS-Fuzz
  fuzz: port fuzz-parse-attr-line from OSS-Fuzz
  fuzz: port fuzz-url-decode-mem from OSS-Fuzz
 Makefile                                   |  3 ++
 attr.c                                     | 40 +-------------------
 attr.h                                     | 43 ++++++++++++++++++++++
 ci/run-build-and-minimal-fuzzers.sh        | 13 ++++++-
 oss-fuzz/.gitignore                        |  3 ++
 oss-fuzz/fuzz-credential-from-url-gently.c | 32 ++++++++++++++++
 oss-fuzz/fuzz-parse-attr-line.c            | 39 ++++++++++++++++++++
 oss-fuzz/fuzz-url-decode-mem.c             | 43 ++++++++++++++++++++++
 8 files changed, 177 insertions(+), 39 deletions(-)
 create mode 100644 oss-fuzz/fuzz-credential-from-url-gently.c
 create mode 100644 oss-fuzz/fuzz-parse-attr-line.c
 create mode 100644 oss-fuzz/fuzz-url-decode-mem.c
Range-diff against v1:
1:  625b8d607e ! 1:  04225dd421 fuzz: port fuzz-credential-from-url-gently from OSS-Fuzz
    @@ ci/run-build-and-minimal-fuzzers.sh: group "Build fuzzers" make \
      
     -for fuzzer in commit-graph config date pack-headers pack-idx ; do
     +fuzzers="
    -+commit-graph \
    -+config \
    -+credential-from-url-gently \
    -+date \
    -+pack-headers \
    -+pack-idx \
    ++commit-graph
    ++config
    ++credential-from-url-gently
    ++date
    ++pack-headers
    ++pack-idx
     +"
     +
    -+for fuzzer in $fuzzers ; do
    ++for fuzzer in $fuzzers; do
      	begin_group "fuzz-$fuzzer"
    --	./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
    -+	echo ./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
    + 	./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
      	end_group "fuzz-$fuzzer"
    - done
     
      ## oss-fuzz/.gitignore ##
     @@
2:  770fe27c67 ! 2:  16c6573190 fuzz: port fuzz-parse-attr-line from OSS-Fuzz
    @@ attr.c: static const char *parse_attr(const char *src, int lineno, const char *c
      }
      
     -static struct match_attr *parse_attr_line(const char *line, const char *src,
    +-					  int lineno, unsigned flags)
     +struct match_attr *parse_attr_line(const char *line, const char *src,
    - 					  int lineno, unsigned flags)
    ++				   int lineno, unsigned flags)
      {
      	size_t namelen, num_attr, i;
    + 	const char *cp, *name, *states;
     
      ## attr.h ##
     @@ attr.h: int git_attr_system_is_enabled(void);
    @@ attr.h: int git_attr_system_is_enabled(void);
     +};
     +
     +struct match_attr *parse_attr_line(const char *line, const char *src,
    -+					  int lineno, unsigned flags);
    ++				   int lineno, unsigned flags);
     +
      #endif /* ATTR_H */
     
      ## ci/run-build-and-minimal-fuzzers.sh ##
    -@@ ci/run-build-and-minimal-fuzzers.sh: credential-from-url-gently \
    - date \
    - pack-headers \
    - pack-idx \
    -+parse-attr-line \
    +@@ ci/run-build-and-minimal-fuzzers.sh: credential-from-url-gently
    + date
    + pack-headers
    + pack-idx
    ++parse-attr-line
      "
      
    - for fuzzer in $fuzzers ; do
    + for fuzzer in $fuzzers; do
     
      ## oss-fuzz/.gitignore ##
     @@ oss-fuzz/.gitignore: fuzz-credential-from-url-gently
3:  4c9813313c ! 3:  ec6b5eed71 fuzz: port fuzz-url-decode-mem from OSS-Fuzz
    @@ Makefile: FUZZ_OBJS += oss-fuzz/fuzz-date.o
      
     
      ## ci/run-build-and-minimal-fuzzers.sh ##
    -@@ ci/run-build-and-minimal-fuzzers.sh: date \
    - pack-headers \
    - pack-idx \
    - parse-attr-line \
    -+url-decode-mem \
    +@@ ci/run-build-and-minimal-fuzzers.sh: date
    + pack-headers
    + pack-idx
    + parse-attr-line
    ++url-decode-mem
      "
      
    - for fuzzer in $fuzzers ; do
    + for fuzzer in $fuzzers; do
     
      ## oss-fuzz/.gitignore ##
     @@ oss-fuzz/.gitignore: fuzz-date
base-commit: 159f2d50e75c17382c9f4eb7cbda671a6fa612d1
-- 
2.47.0.rc1.288.g06298d1525-goog
Previous: Junio C HamanoNext: Josh Steadmon
Message 10 of 13 in “fuzz: port OSS-Fuzz tests back to Git”
  1. 0/3 fuzz: port OSS-Fuzz tests back to GitJosh Steadmon, Oct 10, 2024
  2. 1/3 fuzz: port fuzz-credential-from-url-gently from OSS-FuzzJosh Steadmon, Oct 10, 2024
  3. Oswald BuddenhagenOct 11, 2024
  4. Junio C HamanoOct 11, 2024
  5. Josh SteadmonOct 14, 2024
  6. Josh SteadmonOct 14, 2024
  7. 2/3 fuzz: port fuzz-parse-attr-line from OSS-FuzzJosh Steadmon, Oct 10, 2024
  8. 3/3 fuzz: port fuzz-url-decode-mem from OSS-FuzzJosh Steadmon, Oct 10, 2024
  9. Junio C HamanoOct 10, 2024
  10. 0/3 fuzz: port OSS-Fuzz tests back to GitJosh Steadmon, Oct 14, 2024
  11. 1/3 fuzz: port fuzz-credential-from-url-gently from OSS-FuzzJosh Steadmon, Oct 14, 2024
  12. 2/3 fuzz: port fuzz-parse-attr-line from OSS-FuzzJosh Steadmon, Oct 14, 2024
  13. 3/3 fuzz: port fuzz-url-decode-mem from OSS-FuzzJosh Steadmon, Oct 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.