summaryrefslogtreecommitdiff
path: root/pdf/pdf_doc.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-06-23 10:21:17 +0100
committerKen Sharp <ken.sharp@artifex.com>2022-06-23 10:52:23 +0100
commit0acf32607fb27753ff5a78ab5b8c73869b8095d6 (patch)
treefba453a6425a386465e6cb94e21fc11d3fb47a02 /pdf/pdf_doc.c
parent9a5fcb9dcc80dda464472836e18b81ecbb6ceec0 (diff)
downloadghostpdl-0acf32607fb27753ff5a78ab5b8c73869b8095d6.tar.gz
GhostPDF - more work on Info dictionaries....
OSS-fuzz #48205 Now that objects are not always pointers to structures, we can't assume that we can simply dereference them. Fortunately the only objects for which we want to store the object number in this case are the composite objects (array and dictionary) so we can just store the object number for those.
Diffstat (limited to 'pdf/pdf_doc.c')
-rw-r--r--pdf/pdf_doc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/pdf/pdf_doc.c b/pdf/pdf_doc.c
index 969d63b0f..37b58f219 100644
--- a/pdf/pdf_doc.c
+++ b/pdf/pdf_doc.c
@@ -117,19 +117,23 @@ static int Info_check_array(pdf_context *ctx, pdf_array *a)
if (code < 0)
goto error;
- if (array_obj->object_num != 0) {
- code = pdfi_loop_detector_add_object(ctx, array_obj->object_num);
- if (code < 0)
- goto error;
- }
-
switch(pdfi_type_of(array_obj)) {
case PDF_DICT:
+ if (array_obj->object_num != 0) {
+ code = pdfi_loop_detector_add_object(ctx, array_obj->object_num);
+ if (code < 0)
+ goto error;
+ }
code = Info_check_dict(ctx, (pdf_dict *)array_obj);
if (code < 0)
goto error;
break;
case PDF_ARRAY:
+ if (array_obj->object_num != 0) {
+ code = pdfi_loop_detector_add_object(ctx, array_obj->object_num);
+ if (code < 0)
+ goto error;
+ }
code = Info_check_array(ctx, (pdf_array *)array_obj);
if (code < 0)
goto error;