diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2016-01-12 14:43:17 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2016-01-12 14:43:17 +0000 |
commit | fde64dbcf02a2548145d662196e83cd0319cece5 (patch) | |
tree | 7352b722ce209078567a418166f02e03ba3af4af /psi/zchar.c | |
parent | 15b3f5cbf12461e2ed318e793669b7c34e32089b (diff) | |
download | ghostpdl-fde64dbcf02a2548145d662196e83cd0319cece5.tar.gz |
PS interpreter - properly handle errors when preparing to run CDevProc
Bug #696503 " Regression: segfault with pdfwrite starting with 2deb460ef02e2802546e09979243764ede2d4173"
The bug title is something of a misnomer, the stated commit does not
cause the problem, it simply shifts memory around and exposes the
already existing bug.
The problem is caused by a faulty CIDFont, and the default behaviour of
the PDF interpreter, which does not halt when an error is encountered.
When running CIDFonts we need to execute a CDevProc in order to add the
PDF /W or /W2 values to the width of the glyph. However, the font we use
when setting up to run the CDevProc is broken so badly that we throw an
error from z1_set_cache. We return the error, but we don't terminate
the text enumerator, which leads to us continuing with the text. Not
surprisingly this eventually crashes.
This commit terminates the 'show' operation if it detects an error when
setting up to run the CDevProc.
No differences expected
Diffstat (limited to 'psi/zchar.c')
-rw-r--r-- | psi/zchar.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/psi/zchar.c b/psi/zchar.c index 51081f0b7..095a1fc41 100644 --- a/psi/zchar.c +++ b/psi/zchar.c @@ -725,6 +725,8 @@ op_show_continue_dispatch(i_ctx_t *i_ctx_p, int npop, int code) return_error(gs_error_unregistered); /* Unimplemented. */ if (exec_cont != 0) return_error(gs_error_unregistered); /* Must not happen. */ + if (code < 0) + return op_show_free(i_ctx_p, code); return code; } default: /* error */ |