From e2e155fe0ee0c7feacbbca6e93a8ca880c89052f Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 8 Apr 2020 00:10:11 +0800 Subject: [PATCH] Update flags and enable new sanitizer (#3587) * [ghostscript] Replace deprecated flag by current flag. In old versions of Ghostscript the flag -dPARANOIDSAFER did more checks than -dSAFER did. In modern versions the two flags are identical. Moreover the flag -dPARANOIDSAFER has been deprecated for a long time, and may be removed in the future. In Ghostscript 9.50 and later -dSAFER is the default, and does not have to be specified. To be able to test older yet still modern Ghostscript versions without problems -dSAFER is used. * [ghostscript] Force enable banding while rendering. Ghostscript uses the set resolution to determine if banding should be enabled during rendering, or not. Under normal circumstances documents are rendered at maybe 600 DPI, but to conserve memory while running in OSS-fuzz 200 DPI is used (-r200x200). To still test the banding code used under normal circumstances banding is force enabled. Moreover BufferSpace is used to determine the band height and thus the number of bands. At 600 DPI this is normally 4Mbyte, so a reasonable approximate at 200 DPI is 450k. Thus BufferSpace is also set. * [ghostscript] Enable another sanitizer to see more issues. --- projects/ghostscript/gstoraster_fuzzer.cc | 4 +++- projects/ghostscript/project.yaml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/ghostscript/gstoraster_fuzzer.cc b/projects/ghostscript/gstoraster_fuzzer.cc index e5343fa61..1f2dd358a 100644 --- a/projects/ghostscript/gstoraster_fuzzer.cc +++ b/projects/ghostscript/gstoraster_fuzzer.cc @@ -58,10 +58,12 @@ static int gs_to_raster_fuzz(const unsigned char *buf, size_t size) "gs", "-K1048576", "-r200x200", + "-dMaxBitmap=0", + "-dBufferSpace=450k", "-dMediaPosition=1", "-dcupsColorSpace=1", /* RGB */ "-dQUIET", - "-dPARANOIDSAFER", + "-dSAFER", "-dNOPAUSE", "-dBATCH", "-dNOINTERPOLATE", diff --git a/projects/ghostscript/project.yaml b/projects/ghostscript/project.yaml index 20b54be5e..336183c82 100644 --- a/projects/ghostscript/project.yaml +++ b/projects/ghostscript/project.yaml @@ -8,3 +8,4 @@ auto_ccs: - "julians.artifex@gmail.com" sanitizers: - address + - memory