diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-01-26 13:01:00 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-01-26 15:16:36 +0000 |
commit | e2dcca3031f485e2c8ababb7afe3836b7712ea4f (patch) | |
tree | 5489ebb9801a896db2d3fbd2f5369e9df0b97669 | |
parent | 56ce141027946e0886ebb1569d4d0d7a16108c0e (diff) | |
download | ghostpdl-e2dcca3031f485e2c8ababb7afe3836b7712ea4f.tar.gz |
OSS Fuzz 42916: Fix memory squeezing double free.
In pdfi_gstate_from_PS, don't swap out graphics state entries
until we know that all the allocations have worked.
-rw-r--r-- | pdf/ghostpdf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/ghostpdf.c b/pdf/ghostpdf.c index dc03aef74..625b0fca9 100644 --- a/pdf/ghostpdf.c +++ b/pdf/ghostpdf.c @@ -2045,11 +2045,11 @@ int pdfi_gstate_from_PS(pdf_context *ctx, gs_gstate *pgs, pdfi_switch_t *i_switc i_switch->procs = pgs->client_procs; i_switch->client_data = (void *)pgs->client_data; i_switch->profile_cache = pgs->icc_profile_cache; - pgs->icc_profile_cache = profile_cache; code = pdfi_gstate_set_client(ctx, pgs); if (code < 0) return code; i_switch->psfont = pgs->font; + pgs->icc_profile_cache = profile_cache; pgs->font = NULL; ctx->pgs = pgs; return code; |