From 4aa284be10e8ddf4afa4d91ace3bf1f2682988f5 Mon Sep 17 00:00:00 2001 From: Chris Liddell Date: Mon, 24 Jan 2022 15:41:59 +0000 Subject: oss-fuzz 43989: handle error codes interpreting Type 3 glyphs Failing to do so was leaving the graphics state stack in an undefined state --- pdf/pdf_font3.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pdf/pdf_font3.c') 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]); -- cgit v1.2.1