From e1652d0b73989b77a914f6a0de58ec6f53fc8e01 Mon Sep 17 00:00:00 2001 From: Shailesh Mistry Date: Sat, 5 May 2018 20:23:13 +0100 Subject: 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 --- base/gspaint.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'base/gspaint.c') 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 */ -- cgit v1.2.1