summaryrefslogtreecommitdiff
path: root/pdf/pdf_xref.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-02-14 11:47:24 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-02-14 11:47:24 +0000
commit30770fce40f0b47c4da1c41e187b45f9f59edc63 (patch)
tree3e2cb0d4a3d736a193c0f4bec60eef3389e4a9ca /pdf/pdf_xref.c
parente83a349bf7a7dee1dd31a1c35b0d6f52ddd23c16 (diff)
downloadghostpdl-30770fce40f0b47c4da1c41e187b45f9f59edc63.tar.gz
OSS-fuzz #44610 - don't process 'empty' Xref streams
If the Xref stream declares it has a /Size of 0, then it has no entries so we should simply stop.
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r--pdf/pdf_xref.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index edab8e396..c1f61591a 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -175,6 +175,8 @@ static int pdfi_process_xref_stream(pdf_context *ctx, pdf_stream *stream_obj, pd
code = pdfi_dict_get_int(ctx, sdict, "Size", &size);
if (code < 0)
return code;
+ if (size < 1)
+ return 0;
if (size < 0 || size > floor((double)ARCH_MAX_SIZE_T / (double)sizeof(xref_entry)))
return_error(gs_error_rangecheck);