summaryrefslogtreecommitdiff
path: root/pdf/pdf_xref.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-12-20 15:22:15 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-12-20 15:22:15 +0000
commitad1680cb05f76fbd99712e91ce623501db51a4e0 (patch)
tree04b81c2c255618698bf62adbc0cb453f56734fb6 /pdf/pdf_xref.c
parentaae2e146ba7f39cfa13b665286abce3bff8a6c6e (diff)
downloadghostpdl-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.c3
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;