summaryrefslogtreecommitdiff
path: root/pdf/pdf_font3.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2022-01-24 15:41:59 +0000
committerChris Liddell <chris.liddell@artifex.com>2022-01-25 08:49:28 +0000
commit4aa284be10e8ddf4afa4d91ace3bf1f2682988f5 (patch)
treee08cbcb581825f1c98068918d38c70ac29d46e79 /pdf/pdf_font3.c
parentb0f97408aa942bf2c44b6074c9697847d07f1dd3 (diff)
downloadghostpdl-4aa284be10e8ddf4afa4d91ace3bf1f2682988f5.tar.gz
oss-fuzz 43989: handle error codes interpreting Type 3 glyphs
Failing to do so was leaving the graphics state stack in an undefined state
Diffstat (limited to 'pdf/pdf_font3.c')
-rw-r--r--pdf/pdf_font3.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pdf/pdf_font3.c b/pdf/pdf_font3.c
index fd8619ee4..9cb3d2885 100644
--- a/pdf/pdf_font3.c
+++ b/pdf/pdf_font3.c
@@ -110,9 +110,11 @@ pdfi_type3_build_char(gs_show_enum * penum, gs_gstate * pgs, gs_font * pfont,
/* Use the utility routine above to copy the fill colour to the stroke colour */
pdfi_type3_copy_color(&OBJ_CTX(font)->pgs->color[0], &OBJ_CTX(font)->pgs->color[1]);
- pdfi_gsave(OBJ_CTX(font));
- pdfi_run_context(OBJ_CTX(font), CharProc, font->PDF_font, true, "CharProc");
- pdfi_grestore(OBJ_CTX(font));
+ code = pdfi_gsave(OBJ_CTX(font));
+ if (code >= 0) {
+ code = pdfi_run_context(OBJ_CTX(font), CharProc, font->PDF_font, true, "CharProc");
+ (void)pdfi_grestore(OBJ_CTX(font));
+ }
/* Use the utility routine above to copy the temporary copy to the stroke colour */
pdfi_type3_copy_color(&tmp_color, &OBJ_CTX(font)->pgs->color[1]);