summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2022-03-21 12:42:54 -0700
committerChris Liddell <chris.liddell@artifex.com>2022-03-22 11:34:45 +0000
commita4b71ab352e9e9b3f849b3727944b6e8ec64e7b0 (patch)
tree7f5ea76783c2a583237817693e6f120ab5363b8c
parent6abd758e502a2cd71045f3db5496ff85478f0abb (diff)
downloadghostpdl-a4b71ab352e9e9b3f849b3727944b6e8ec64e7b0.tar.gz
Bug 705090 oss-fuzz #45892 Bug 705092 oss-fuzz #45823
If begin transparency group returns an error, do not set the GroupPushed state variable to true. Otherwise we will end up doing an unmatched end group command later, leading to the seg fault.
-rw-r--r--pdf/pdf_trans.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pdf/pdf_trans.c b/pdf/pdf_trans.c
index 0fa750b4d..df0194d73 100644
--- a/pdf/pdf_trans.c
+++ b/pdf/pdf_trans.c
@@ -758,7 +758,11 @@ int pdfi_trans_setup(pdf_context *ctx, pdfi_trans_state_t *state, gs_rect *bbox,
if (igs->SMask != NULL && mode != BLEND_MODE_Normal && mode != BLEND_MODE_Compatible)
isolated = true;
code = pdfi_trans_begin_simple_group(ctx, bbox, stroked_bbox, isolated, false);
- state->GroupPushed = true;
+
+ /* Group was not pushed if error */
+ if (code >= 0)
+ state->GroupPushed = true;
+
state->saveStrokeAlpha = gs_getstrokeconstantalpha(ctx->pgs);
state->saveFillAlpha = gs_getfillconstantalpha(ctx->pgs);
code = gs_setfillconstantalpha(ctx->pgs, 1.0);