From f8486364b3689d2841f8195647427f1b690d6ac5 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sat, 4 Mar 2023 19:39:57 +0100 Subject: [PATCH] ClusterFuzzLite: adds fuzzing for TSV and JSON result formats --- .clusterfuzzlite/build.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.clusterfuzzlite/build.sh b/.clusterfuzzlite/build.sh index a18573bf..901311ac 100644 --- a/.clusterfuzzlite/build.sh +++ b/.clusterfuzzlite/build.sh @@ -1,4 +1,23 @@ #!/bin/bash -eu -cd $SRC/oxigraph +shopt -s globstar + +function build_seed_corpus() { + mkdir "/tmp/oxigraph_$1" + for file in **/*."$2" + do + hash=($(sha256sum "$file")) + cp "$file" "/tmp/oxigraph_$1/$hash" + done + zip "$1_seed_corpus.zip" /tmp/"oxigraph_$1"/* + rm -r "/tmp/oxigraph_$1" +} + + +cd "$SRC"/oxigraph cargo fuzz build -O --debug-assertions -cp fuzz/target/x86_64-unknown-linux-gnu/release/sparql_eval $OUT/ +for TARGET in sparql_eval sparql_results_json sparql_results_tsv +do + cp fuzz/target/x86_64-unknown-linux-gnu/release/$TARGET "$OUT"/ +done +build_seed_corpus sparql_results_json json +build_seed_corpus sparql_results_tsv tsv