diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-01-24 15:57:33 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-01-24 17:26:03 +0000 |
commit | 1d88ef8b1863d44d2f469bd2dc43a58e2e51b713 (patch) | |
tree | 446f6b25f86c917f5e40f90c79c1f5c74315a034 /psi/zpdfops.c | |
parent | 717f89684f71c29dcfc715de623dcd7e2bd883ec (diff) | |
download | ghostpdl-1d88ef8b1863d44d2f469bd2dc43a58e2e51b713.tar.gz |
OSS Fuzz 42916: Fix SEGV found during memory squeezing.
Don't memset an allocated block before checking the allocation worked.
Diffstat (limited to 'psi/zpdfops.c')
-rw-r--r-- | psi/zpdfops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/psi/zpdfops.c b/psi/zpdfops.c index 9be1fcc65..c1f2888d7 100644 --- a/psi/zpdfops.c +++ b/psi/zpdfops.c @@ -300,6 +300,10 @@ static int zpdfi_populate_search_paths(i_ctx_t *i_ctx_p, pdf_context *ctx) } ctx->search_paths.resource_paths = (gs_param_string *)gs_alloc_bytes(ctx->memory, sizeof(gs_param_string) * r_size(&pfpath->list), "array of paths"); + if (ctx->search_paths.resource_paths == NULL) { + code = gs_note_error(gs_error_VMerror); + goto done; + } memset(ctx->search_paths.resource_paths, 0x00, sizeof(gs_param_string) * r_size(&pfpath->list)); ctx->search_paths.num_resource_paths = r_size(&pfpath->list); |