naccyde / rpms / systemd

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