summaryrefslogtreecommitdiff
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
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>
-rwxr-xr-xbin/oss-fuzz-setup.sh9
-rw-r--r--vcl/workben/fodpfuzzer.options2
-rw-r--r--vcl/workben/fodsfuzzer.options2
-rw-r--r--vcl/workben/fodt2pdffuzzer.options2
-rw-r--r--vcl/workben/fodtfuzzer.options2
5 files changed, 13 insertions, 4 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
diff --git a/vcl/workben/fodpfuzzer.options b/vcl/workben/fodpfuzzer.options
index 76d308c39d0c..1d9660180c2a 100644
--- a/vcl/workben/fodpfuzzer.options
+++ b/vcl/workben/fodpfuzzer.options
@@ -1,3 +1,3 @@
[libfuzzer]
max_len = 65536
-dict = xml.dict
+dict = odf.dict
diff --git a/vcl/workben/fodsfuzzer.options b/vcl/workben/fodsfuzzer.options
index 76d308c39d0c..1d9660180c2a 100644
--- a/vcl/workben/fodsfuzzer.options
+++ b/vcl/workben/fodsfuzzer.options
@@ -1,3 +1,3 @@
[libfuzzer]
max_len = 65536
-dict = xml.dict
+dict = odf.dict
diff --git a/vcl/workben/fodt2pdffuzzer.options b/vcl/workben/fodt2pdffuzzer.options
index 1ae5aaff4b14..5419e88c7780 100644
--- a/vcl/workben/fodt2pdffuzzer.options
+++ b/vcl/workben/fodt2pdffuzzer.options
@@ -1,3 +1,3 @@
[libfuzzer]
max_len = 2048
-dict = xml.dict
+dict = odf.dict
diff --git a/vcl/workben/fodtfuzzer.options b/vcl/workben/fodtfuzzer.options
index 76d308c39d0c..1d9660180c2a 100644
--- a/vcl/workben/fodtfuzzer.options
+++ b/vcl/workben/fodtfuzzer.options
@@ -1,3 +1,3 @@
[libfuzzer]
max_len = 65536
-dict = xml.dict
+dict = odf.dict