From 503b86fdc2fc6485a7c7d8c71ab3ee4e9ea86599 Mon Sep 17 00:00:00 2001
From: Pompolic <pompolic@special-circumstanc.es>
Date: Mon, 14 Mar 2022 18:15:02 +0100
Subject: [PATCH] Cherry-pick 99e9ff

commit 99e9ffed99a335e6e69cab61fbd05fee77968e42
Author: sumit.ray@baesystems.com <sumit.ray@baesystems.com>
Date:   Fri Mar 11 08:52:01 2022 -0500

    Added a guard to handle return of null -- root cause: Subtype keyword is corrupt causing the subtype field lookup in the dictionary to return NULL - file:fffe3ecc57e62b7a11019557b0328db
80537bf45d46457401512b7c3bf756654
---
 pdf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pdf.c b/pdf.c
index 897f54d..89b8a81 100644
--- a/pdf.c
+++ b/pdf.c
@@ -5179,6 +5179,10 @@ p_stream_data__m(HAllocator *mm__, const Dict *dict, struct Env *aux)
 		 *  Explicitly avoid parsing Image objects to improve speed -- send back NULL
 		 */
 		v = dictentry(dict, "Subtype");
+		if (v == NULL) {
+			fprintf(stdout, "\nFailed to parse Subtype of XObject in dictionary");
+			return (NULL);
+		}
 		if (bytes_eq(v->bytes, "Form")) {
 			//fprintf(stdout, "\n\np_stream_data_m:: Found Form XObject\n");
 			//fprintf(stdout, "p_stream_data_m:: Current XObject count = %lu\n", aux->catalog.xoCount);
-- 
GitLab