aboutsummaryrefslogtreecommitdiff
path: root/projects/ghostscript
diff options
context:
space:
mode:
authorBenjamin Gordon <yetamrra@users.noreply.github.com>2019-07-02 08:38:50 -0600
committerAbhishek Arya <inferno@chromium.org>2019-07-02 07:38:50 -0700
commit8934ff6f8b3dd61dee9f94b6b6a584afdc49ad30 (patch)
tree4ae50785be565d85e35a7ff0263c5644d16280dd /projects/ghostscript
parent024f87dcf97a311f5d8931871054673fb40de524 (diff)
downloadoss-fuzz-8934ff6f8b3dd61dee9f94b6b6a584afdc49ad30.tar.gz
Two fixes for ghostcript (#2562)
* [ghostscript] Fix ininitialized pointer Passing an invalid pointer causes a crash in gs_new_instance. * [ghostscript] Add seed corpus Use the examples distributed with ghostcript as a seed corpus.
Diffstat (limited to 'projects/ghostscript')
-rwxr-xr-xprojects/ghostscript/build.sh7
-rw-r--r--projects/ghostscript/gstoraster_fuzzer.cc2
2 files changed, 8 insertions, 1 deletions
diff --git a/projects/ghostscript/build.sh b/projects/ghostscript/build.sh
index 9abc8be1a..cc44e63f8 100755
--- a/projects/ghostscript/build.sh
+++ b/projects/ghostscript/build.sh
@@ -54,3 +54,10 @@ $CXX $CXXFLAGS $CUPS_LDFLAGS -std=c++11 -I. \
-o "$OUT/gstoraster_fuzzer" \
$CUPS_LIBS \
$LIB_FUZZING_ENGINE bin/gs.a
+
+mkdir -p "$WORK/seeds"
+for f in examples/*.{ps,pdf}; do
+ s=$(sha1sum "$f" | awk '{print $1}')
+ cp "$f" "$WORK/seeds/$s"
+done
+zip -j "$OUT/gstoraster_fuzzer_seed_corpus.zip" "$WORK"/seeds/*
diff --git a/projects/ghostscript/gstoraster_fuzzer.cc b/projects/ghostscript/gstoraster_fuzzer.cc
index b128b7475..3ffb0d283 100644
--- a/projects/ghostscript/gstoraster_fuzzer.cc
+++ b/projects/ghostscript/gstoraster_fuzzer.cc
@@ -37,7 +37,7 @@ static int gs_stdout(void *inst, const char *buf, int len)
static int gs_to_raster_fuzz(const unsigned char *buf, size_t size)
{
int ret;
- void *gs;
+ void *gs = NULL;
/* Mostly stolen from cups-filters gstoraster. */
char *args[] = {