diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-12-20 15:22:15 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-12-20 15:22:15 +0000 |
commit | ad1680cb05f76fbd99712e91ce623501db51a4e0 (patch) | |
tree | 04b81c2c255618698bf62adbc0cb453f56734fb6 /pdf/pdf_xref.c | |
parent | aae2e146ba7f39cfa13b665286abce3bff8a6c6e (diff) | |
download | ghostpdl-ad1680cb05f76fbd99712e91ce623501db51a4e0.tar.gz |
GhostPDF - check an allocation
Desk-checking for OSS-fuzz 54436 I couldn't see how the problem can
occur, but I do see that we fail to check an allocation.
Add code to check for that and return an error if it happens.
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r-- | pdf/pdf_xref.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 6aa5296e1..b73f2cd5d 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -68,6 +68,9 @@ static int read_xref_stream_entries(pdf_context *ctx, pdf_c_stream *s, int64_t f field_width = W[2]; Buffer = gs_alloc_bytes(ctx->memory, field_width, "read_xref_stream_entry working buffer"); + if (Buffer == NULL) + return_error(gs_error_VMerror); + for (i=first;i<=last; i++){ /* Defaults if W[n] = 0 */ type = 1; |