summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-11-22 11:42:41 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-11-22 11:42:41 +0000
commit2fbc816318dcdb0b16a6ea2e357d773a44dd134e (patch)
treea61470ed508b0a8bb939fc8074b3210b8196eebb /devices
parentfec8fa30d2fa70e882f415a9b0eb4b70e4bf452b (diff)
downloadghostpdl-2fbc816318dcdb0b16a6ea2e357d773a44dd134e.tar.gz
pdfwrite - move current_font assignment after error check
Coverity ID 381906 this is actually a false positive from Coverity, we can't restore the current_font, because we haven't saved it. Not only that but the conditions under which we save and restore the current font are different. We only do that for the fallback case and this is a last ditch (and should never happen) error check. But it makes sense not to corrupt current_font by assigning an invalid font to it, so don't do the assignment until after the error check.
Diffstat (limited to 'devices')
-rw-r--r--devices/vector/gdevpdtc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/devices/vector/gdevpdtc.c b/devices/vector/gdevpdtc.c
index 7ad7dec41..64e392124 100644
--- a/devices/vector/gdevpdtc.c
+++ b/devices/vector/gdevpdtc.c
@@ -797,11 +797,11 @@ scan_cmap_text(pdf_text_enum_t *pte, void *vbuf)
pte->text.operation = save_op;
pte->text.data.glyphs = save_data;
}
- pte->current_font = subfont0;
if (!subfont0 || !pdsubf0)
/* This should be impossible */
return_error(gs_error_invalidfont);
+ pte->current_font = subfont0;
code = gs_matrix_multiply(&subfont0->FontMatrix, &font->FontMatrix, &m3);
/* We thought that it should be gs_matrix_multiply(&font->FontMatrix, &subfont0->FontMatrix, &m3); */
if (code < 0)