summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-05-05 15:37:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-05-05 16:41:13 +0200
commit6dc61f97cbd8333632e87155a8deaa5b7d45b60d (patch)
tree3b44e1885c0666b74635b6241249164276dcca12 /bin
parent61c06d531171c079a032097e00b9602a192cbd1f (diff)
build and use an odf fuzzing dictionary
Change-Id: Ib6dabc636cd171151ce77e48a0e774e955ab7ce3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151434 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/oss-fuzz-setup.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/oss-fuzz-setup.sh b/bin/oss-fuzz-setup.sh
index 2787e46fa973..15c99fa0ab33 100755
--- a/bin/oss-fuzz-setup.sh
+++ b/bin/oss-fuzz-setup.sh
@@ -92,6 +92,15 @@ curl --no-progress-meter -S \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/webp.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/zip.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/mathml.dict
+# build our own fuzz dict for odf, following the pattern of svg.dict
+echo "# Keywords taken from libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng" > odf.dict
+echo "# tags" >> odf.dict
+grep "rng:element name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:element name="#"<#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
+echo "# attributes " >> odf.dict
+grep "rng:attribute name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:attribute name="#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
+echo "# attributes' values" >> odf.dict
+grep "rng:value" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:value>#"#;s#</rng:value>#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' | sort | uniq >> odf.dict
+
#fuzzing corpuses
#afl jpeg, gif, bmp, png, webp
curl --no-progress-meter -S -C - -O https://lcamtuf.coredump.cx/afl/demo/afl_testcases.tgz