summaryrefslogtreecommitdiff
path: root/pdf/ghostpdf.h
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2021-12-20 17:22:28 +0000
committerKen Sharp <ken.sharp@artifex.com>2021-12-20 17:22:28 +0000
commit37045857644b608cbb2f14038d0d794d8575d6c7 (patch)
tree533996d9ac1f939ec5bdea28716edd24b747518d /pdf/ghostpdf.h
parent5197b3b40ea834452618d806c26286039e1077a4 (diff)
downloadghostpdl-37045857644b608cbb2f14038d0d794d8575d6c7.tar.gz
OS-fuzz #42718 - don't use ctx->Trailer directly.
If we repair the file (which can happen any time) it is possible that ctx->Trailer might be replaced. If we are using it, and have not taken a separate reference, then it could vanish while we are using it. Since this isn't the first time this has come up, review and amend all places using ctx->Trailer to use a temporary reference instead. Add comments in each location and add comments to the definition in ghostpdf.h to try and avoid a repetition.
Diffstat (limited to 'pdf/ghostpdf.h')
-rw-r--r--pdf/ghostpdf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/pdf/ghostpdf.h b/pdf/ghostpdf.h
index 21ff456db..6e6c48e40 100644
--- a/pdf/ghostpdf.h
+++ b/pdf/ghostpdf.h
@@ -445,6 +445,9 @@ typedef struct pdf_context_s
/* Document level PDF objects */
xref_table_t *xref_table;
+ /* Warning! Do not use ctx->Trailer directly as it may be replaced if the file is repaired.
+ * See pdf_doc.c, pdf_read_Root()
+ */
pdf_dict *Trailer;
pdf_dict *Root;
pdf_dict *Info;