diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-08-22 08:09:40 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-08-22 08:09:40 +0100 |
commit | b33f71d888f431eecf59163a32d136d3fc898aa8 (patch) | |
tree | 06f1d3e87f08a45fab4d7a2a4be0ee71b931a4a9 | |
parent | 644970756fcbd70e3eb7371031b7b7cd68c54232 (diff) | |
download | ghostpdl-b33f71d888f431eecf59163a32d136d3fc898aa8.tar.gz |
GhostPDF - correct returrn code check
Bug #705769 "NULL pointer dereference in pdf/pdf_misc.c:110 in pdfi_name"
pdfi_dict_knownget_type returns a typecheck error if the object has the
wrong type. So we need to check for a return code > 0.
-rw-r--r-- | pdf/pdf_doc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/pdf_doc.c b/pdf/pdf_doc.c index fb5d4f491..1658941a5 100644 --- a/pdf/pdf_doc.c +++ b/pdf/pdf_doc.c @@ -845,7 +845,7 @@ int pdfi_find_resource(pdf_context *ctx, unsigned char *Type, pdf_name *name, /* If the current dictionary is a Page dictionary, do NOT dereference it's Parent, as that * will be the Pages tree, and we will end up with circular references, causing a memory leak. */ - if (pdfi_dict_knownget_type(ctx, dict, "Type", PDF_NAME, (pdf_obj **)&n)) { + if (pdfi_dict_knownget_type(ctx, dict, "Type", PDF_NAME, (pdf_obj **)&n) > 0) { if (pdfi_name_is(n, "Page")) deref_parent = false; pdfi_countdown(n); |