Update OSS-Fuzz Scripts to Use New QA-Assets Repo Structure · gitpython-developers/GitPython@2cfd200 · GitHub
Skip to content

Commit 2cfd200

Browse files
committed
Update OSS-Fuzz Scripts to Use New QA-Assets Repo Structure
This change is required to support the changes to the seed data repo structure introduced in: gitpython-developers/qa-assets#2 This moves most of the seed data related build steps into the OSS-Fuzz Docker image build via `container-environment-bootstrap.sh`. This includes moveing the dictionaries into that repo. The fuzzing/README.md here should be updated in a follow-up with a link to the qa-assets repo (and probably some context setting about corpora in general) but I have opted to defer that as I think the functionality added by the seed data improvements is valuable as is and shouldn't be blocked by documentation writers block.
1 parent 2493c3a commit 2cfd200

5 files changed

Lines changed: 53 additions & 114 deletions

File tree

fuzzing/README.md

Lines changed: 0 additions & 19 deletions

fuzzing/dictionaries/fuzz_blob.dict

Lines changed: 0 additions & 1 deletion
This file was deleted.

fuzzing/dictionaries/fuzz_config.dict

Lines changed: 0 additions & 56 deletions
This file was deleted.

fuzzing/oss-fuzz-scripts/build.sh

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,13 @@ set -euo pipefail
77

88
python3 -m pip install .
99

10-
# Directory to look in for dictionaries, options files, and seed corpora:
11-
SEED_DATA_DIR="$SRC/seed_data"
12-
13-
find "$SEED_DATA_DIR" \( -name '*_seed_corpus.zip' -o -name '*.options' -o -name '*.dict' \) \
14-
! \( -name '__base.*' \) -exec printf 'Copying: %s\n' {} \; \
10+
find "$SRC" -maxdepth 1 \
11+
\( -name '*_seed_corpus.zip' -o -name '*.options' -o -name '*.dict' \) \
12+
-exec printf '[%s] Copying: %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" {} \; \
1513
-exec chmod a-x {} \; \
1614
-exec cp {} "$OUT" \;
1715

1816
# Build fuzzers in $OUT.
1917
find "$SRC/gitpython/fuzzing" -name 'fuzz_*.py' -print0 | while IFS= read -r -d '' fuzz_harness; do
2018
compile_python_fuzzer "$fuzz_harness" --add-binary="$(command -v git):."
21-
22-
common_base_dictionary_filename="$SEED_DATA_DIR/__base.dict"
23-
if [[ -r "$common_base_dictionary_filename" ]]; then
24-
# Strip the `.py` extension from the filename and replace it with `.dict`.
25-
fuzz_harness_dictionary_filename="$(basename "$fuzz_harness" .py).dict"
26-
output_file="$OUT/$fuzz_harness_dictionary_filename"
27-
28-
printf 'Appending %s to %s\n' "$common_base_dictionary_filename" "$output_file"
29-
if [[ -s "$output_file" ]]; then
30-
# If a dictionary file for this fuzzer already exists and is not empty,
31-
# we append a new line to the end of it before appending any new entries.
32-
#
33-
# LibFuzzer will happily ignore multiple empty lines in a dictionary but fail with an error
34-
# if any single line has incorrect syntax (e.g., if we accidentally add two entries to the same line.)
35-
# See docs for valid syntax: https://llvm.org/docs/LibFuzzer.html#id32
36-
echo >>"$output_file"
37-
fi
38-
cat "$common_base_dictionary_filename" >>"$output_file"
39-
fi
4019
done

fuzzing/oss-fuzz-scripts/container-environment-bootstrap.sh

Lines changed: 50 additions & 14 deletions

0 commit comments

Comments
 (0)