diff --git a/projects/ghostscript/build.sh b/projects/ghostscript/build.sh index a22d4b307..aee05cfd7 100755 --- a/projects/ghostscript/build.sh +++ b/projects/ghostscript/build.sh @@ -45,7 +45,7 @@ CPPFLAGS="${CPPFLAGS:-} $CUPS_CFLAGS -DPACIFY_VALGRIND" ./autogen.sh \ CUPSCONFIG=$CUPSCONFIG \ --enable-freetype --enable-fontconfig \ --enable-cups --with-ijs --with-jbig2dec \ - --with-drivers=pdfwrite,cups,ljet4,laserjet,pxlmono,pxlcolor,pcl3,uniprint,pgmraw,ps2write,png16m,tiffsep1,faxg3,psdcmyk,eps2write,bmpmono + --with-drivers=pdfwrite,cups,ljet4,laserjet,pxlmono,pxlcolor,pcl3,uniprint,pgmraw,ps2write,png16m,tiffsep1,faxg3,psdcmyk,eps2write,bmpmono,xpswrite make -j$(nproc) libgs fuzzers="gstoraster_fuzzer \ @@ -61,6 +61,8 @@ fuzzers="gstoraster_fuzzer \ gs_device_eps2write_fuzzer \ gs_device_faxg3_fuzzer \ gs_device_bmpmono_fuzzer \ + gs_device_xpswrite_fuzzer \ + gs_device_pxlcolor_fuzzer \ gs_device_tiffsep1_fuzzer" for fuzzer in $fuzzers; do @@ -100,6 +102,8 @@ cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_pdfwrite_fuzzer_seed cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_pxlmono_fuzzer_seed_corpus.zip" cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_eps2write_fuzzer_seed_corpus.zip" cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_bmpmono_fuzzer_seed_corpus.zip" +cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_xpswrite_fuzzer_seed_corpus.zip" +cp "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$OUT/gs_device_pxlcolor_fuzzer_seed_corpus.zip" # Copy out options cp $SRC/*.options $OUT/ diff --git a/projects/ghostscript/gs_device_pxlcolor_fuzzer.cc b/projects/ghostscript/gs_device_pxlcolor_fuzzer.cc new file mode 100644 index 000000000..6e511c016 --- /dev/null +++ b/projects/ghostscript/gs_device_pxlcolor_fuzzer.cc @@ -0,0 +1,20 @@ +/* Copyright 2022 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include "gs_fuzzlib.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + fuzz_gs_device(data, size, 1, "pxlcolor", "/dev/null"); + return 0; +} diff --git a/projects/ghostscript/gs_device_xpswrite_fuzzer.cc b/projects/ghostscript/gs_device_xpswrite_fuzzer.cc new file mode 100644 index 000000000..a6034230e --- /dev/null +++ b/projects/ghostscript/gs_device_xpswrite_fuzzer.cc @@ -0,0 +1,20 @@ +/* Copyright 2022 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include "gs_fuzzlib.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + fuzz_gs_device(data, size, 1, "xpswrite", "/dev/null"); + return 0; +}