systemd/SOURCES/0233-oss-fuzz-include-generated-corpora-in-the-final-zip-.patch
2023-09-21 20:32:36 +00:00

36 lines
1.3 KiB
Diff

From a810aef1f95727ec3e044441bf02e0261b2e09ec Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Sat, 7 Jan 2023 10:27:05 +0100
Subject: [PATCH] oss-fuzz: include generated corpora in the final zip file
Since the files with generated directives are now automatically
generated during build, they're now under the respective build directory
which the current oss-fuzz CI script didn't account for.
Follow-up to: #24958
Fixes: #25859
(cherry picked from commit bef8d18b3f9776fdb28fc9a4820f9ce9418422f9)
Related: #2176918
---
tools/oss-fuzz.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh
index 793411ed84..7e9312b833 100755
--- a/tools/oss-fuzz.sh
+++ b/tools/oss-fuzz.sh
@@ -97,7 +97,10 @@ rm -rf "$hosts"
# The seed corpus is a separate flat archive for each fuzzer,
# with a fixed name ${fuzzer}_seed_corpus.zip.
for d in test/fuzz/fuzz-*; do
- zip -jqr "$OUT/$(basename "$d")_seed_corpus.zip" "$d"
+ fuzzer="$(basename "$d")"
+ # Include the build-generated corpora if any as well
+ readarray -t generated < <(find "$build/test/fuzz" -maxdepth 1 -name "${fuzzer}*" -type f)
+ zip -jqr "$OUT/${fuzzer}_seed_corpus.zip" "$d" "${generated[@]}"
done
# get fuzz-dns-packet corpus