summaryrefslogtreecommitdiff
path: root/base/gspaint.c
diff options
context:
space:
mode:
authorShailesh Mistry <shailesh.mistry@hotmail.co.uk>2018-05-05 20:23:13 +0100
committerShailesh Mistry <shailesh.mistry@hotmail.co.uk>2018-05-06 12:32:01 +0100
commite1652d0b73989b77a914f6a0de58ec6f53fc8e01 (patch)
treeb4a9e38808e15b1a5d248aa4058f3e1408b46c49 /base/gspaint.c
parent93d78c6299905fe0a192840015f71820772be95c (diff)
downloadghostpdl-e1652d0b73989b77a914f6a0de58ec6f53fc8e01.tar.gz
Bug 697545 : Prevent SEGV after gs_stroke.
Prevent SEGV if memory allocation fails. Error created using :- MEMENTO_FAILAT=9971 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0010
Diffstat (limited to 'base/gspaint.c')
-rw-r--r--base/gspaint.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/base/gspaint.c b/base/gspaint.c
index 31664afed..df9e7a68c 100644
--- a/base/gspaint.c
+++ b/base/gspaint.c
@@ -486,16 +486,12 @@ gs_stroke(gs_gstate * pgs)
if (code < 0)
return code;
}
- if (gs_is_null_device(pgs->device)) {
- /* Handle separately to prevent gs_gstate_color_load. */
- gs_newpath(pgs);
- code = 0;
- } else {
+ if (!gs_is_null_device(pgs->device)) {
code = do_stroke(pgs);
- if (code >= 0)
- gs_newpath(pgs);
+ if (code < 0)
+ return code;
}
- return code;
+ return gs_newpath(pgs);
}
/* Compute the stroked outline of the current path */