diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-02-18 08:37:11 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-02-18 09:25:44 +0000 |
commit | 8c1576c858f3b04a4a0e548ae60868d9105ceffe (patch) | |
tree | 9d350852f788c47f50c92a7a77261d9d82090725 | |
parent | e0a5c6b1f06d970daf393d9a14d8e56f26d97e61 (diff) | |
download | ghostpdl-8c1576c858f3b04a4a0e548ae60868d9105ceffe.tar.gz |
OSS-fuzz #44781 - Don't try to set colour space name if creation fails
Says it all really. We store the colour space name for named spaces, so
we can spot attempts to change colour space using the existing current
space.
But if we fail to create/set the space, then it doesn't exist, so we
can't apply the name to it.
-rw-r--r-- | pdf/pdf_colour.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pdf/pdf_colour.c b/pdf/pdf_colour.c index a15a0e196..19decebb1 100644 --- a/pdf/pdf_colour.c +++ b/pdf/pdf_colour.c @@ -2421,10 +2421,12 @@ pdfi_create_colorspace_by_name(pdf_context *ctx, pdf_name *name, /* recursion */ code = pdfi_create_colorspace(ctx, ref_space, stream_dict, page_dict, ppcs, inline_image); - if (ppcs != NULL) - pdfi_set_colourspace_name(ctx, *ppcs, name); - else - pdfi_set_colourspace_name(ctx, ctx->pgs->color[0].color_space, name); + if (code >= 0) { + if (ppcs != NULL) + pdfi_set_colourspace_name(ctx, *ppcs, name); + else + pdfi_set_colourspace_name(ctx, ctx->pgs->color[0].color_space, name); + } pdfi_countdown(ref_space); return code; |