diff options
author | DavidKorczynski <david@adalogics.com> | 2022-07-09 21:10:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 21:10:48 +0100 |
commit | 3c04a4fab3273f05540d34ab82e449051f45f54f (patch) | |
tree | 6e15b87ffad782418ffda7c54136703368940349 /projects | |
parent | de0466fb498c8fdf57be802b262faff5983c0dd3 (diff) |
ghostscript: add three new devices fuzzers (#7981)
* ghostscript: add three new devices fuzzers
* nits
* simplify build
Diffstat (limited to 'projects')
-rwxr-xr-x | projects/ghostscript/build.sh | 14 | ||||
-rw-r--r-- | projects/ghostscript/gs_device_pgmraw_fuzzer.cc | 20 | ||||
-rw-r--r-- | projects/ghostscript/gs_device_png16m_fuzzer.cc | 20 | ||||
-rw-r--r-- | projects/ghostscript/gs_device_ps2write_fuzzer.cc | 20 |
4 files changed, 71 insertions, 3 deletions
diff --git a/projects/ghostscript/build.sh b/projects/ghostscript/build.sh index 29261339..18325d8e 100755 --- a/projects/ghostscript/build.sh +++ b/projects/ghostscript/build.sh @@ -31,7 +31,6 @@ popd rm -rf cups/libs || die rm -rf freetype || die -rm -rf libpng || die rm -rf zlib || die mv $SRC/freetype freetype @@ -46,11 +45,20 @@ 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 + --with-drivers=pdfwrite,cups,ljet4,laserjet,pxlmono,pxlcolor,pcl3,uniprint,pgmraw,ps2write,png16m make -j$(nproc) libgs +fuzzers="gstoraster_fuzzer \ + gstoraster_fuzzer_all_colors \ + gstoraster_ps_fuzzer \ + gstoraster_pdf_fuzzer \ + gs_device_pdfwrite_fuzzer \ + gs_device_pxlmono_fuzzer \ + gs_device_pgmraw_fuzzer \ + gs_device_ps2write_fuzzer \ + gs_device_png16m_fuzzer" -for fuzzer in gstoraster_pdf_fuzzer gstoraster_fuzzer gstoraster_fuzzer_all_colors gstoraster_ps_fuzzer gs_device_pdfwrite_fuzzer gs_device_pxlmono_fuzzer; do +for fuzzer in $fuzzers; do $CXX $CXXFLAGS $CUPS_LDFLAGS -std=c++11 -I. -I$SRC \ $SRC/${fuzzer}.cc \ -o "$OUT/${fuzzer}" \ diff --git a/projects/ghostscript/gs_device_pgmraw_fuzzer.cc b/projects/ghostscript/gs_device_pgmraw_fuzzer.cc new file mode 100644 index 00000000..30e51c5b --- /dev/null +++ b/projects/ghostscript/gs_device_pgmraw_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, "pgmraw"); + return 0; +} diff --git a/projects/ghostscript/gs_device_png16m_fuzzer.cc b/projects/ghostscript/gs_device_png16m_fuzzer.cc new file mode 100644 index 00000000..0d522ce3 --- /dev/null +++ b/projects/ghostscript/gs_device_png16m_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, "png16m"); + return 0; +} diff --git a/projects/ghostscript/gs_device_ps2write_fuzzer.cc b/projects/ghostscript/gs_device_ps2write_fuzzer.cc new file mode 100644 index 00000000..d551e2d3 --- /dev/null +++ b/projects/ghostscript/gs_device_ps2write_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, "ps2write"); + return 0; +} |