diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-02-18 10:56:25 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-02-18 10:56:25 +0000 |
commit | 6ef16fa3f2548a98d7039d2a6bfdeb9e3d879455 (patch) | |
tree | 2d20f176c2dc12ae557303a03dc326c6236e6729 | |
parent | 8c1576c858f3b04a4a0e548ae60868d9105ceffe (diff) | |
download | ghostpdl-6ef16fa3f2548a98d7039d2a6bfdeb9e3d879455.tar.gz |
Coverity IDs 374941, 375552, 375572 (redux)
There were obviously duplicate cases of these which I missed because
I find the Coverity web interface hard to use. Fixed them here.
-rw-r--r-- | pdf/pdf_colour.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pdf/pdf_colour.c b/pdf/pdf_colour.c index 19decebb1..feac6c4e1 100644 --- a/pdf/pdf_colour.c +++ b/pdf/pdf_colour.c @@ -710,6 +710,7 @@ int pdfi_setstrokecolor(pdf_context *ctx) int ncomps, code; gs_client_color cc; + cc.pattern = 0; gs_swapcolors_quick(ctx->pgs); pcs = gs_currentcolorspace(ctx->pgs); ncomps = cs_num_components(pcs); @@ -731,6 +732,7 @@ int pdfi_setfillcolor(pdf_context *ctx) int ncomps, code; gs_client_color cc; + cc.pattern = 0; ncomps = cs_num_components(pcs); if (ncomps < 1) return_error(gs_error_syntaxerror); @@ -770,6 +772,8 @@ pdfi_setcolorN(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict, boo goto cleanupExit1; } + memset(&cc, 0x00, sizeof(gs_client_color)); + if (pcs->type == &gs_color_space_type_Pattern) is_pattern = true; if (is_pattern) { @@ -778,7 +782,6 @@ pdfi_setcolorN(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict, boo code = gs_note_error(gs_error_syntaxerror); goto cleanupExit0; } - cc.pattern = 0; /* For safe cleaning up on an error */ base_space = pcs->base_space; code = pdfi_pattern_set(ctx, stream_dict, page_dict, (pdf_name *)ctx->stack_top[-1], &cc); pdfi_pop(ctx, 1); @@ -792,10 +795,8 @@ pdfi_setcolorN(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict, boo ncomps = cs_num_components(base_space); else ncomps = 0; - } else { + } else ncomps = cs_num_components(pcs); - cc.pattern = 0; - } if (ncomps > 0) { code = pdfi_get_color_from_stack(ctx, &cc, ncomps); |