diff --git a/pdf.c b/pdf.c index 72d1ed31629345f089958edfb0799148e9c86e72..6502f7027039b40e96dff971630dc8de3767e90f 100644 --- a/pdf.c +++ b/pdf.c @@ -4360,24 +4360,15 @@ parse_catalog(struct Env *aux, const HParsedToken *root) void process_page_content(struct Env *aux) { - const HParsedToken *tok, *xref; + const HParsedToken *tok; Dict *trailer; size_t Size; - /* use the last xref section */ + /* find the last trailer dictionary */ if (aux->nxrefs == 0) return; - xref = aux->xrefs[aux->nxrefs - 1]; - - /* make sure we parsed a valid trailer dictionary */ - tok = H_INDEX_TOKEN(xref, 1); - trailer = H_CAST(Dict, tok); - if (trailer == NULL) { - // XXX this cannot actually happen (rule xr_td) - log_message(7, "VIOLATION[7]: Invalid Trailer Section " - "or Trailer Section not found\n"); - return; - } + tok = aux->xrefs[aux->nxrefs - 1]; /* last xref section */ + trailer = H_INDEX(Dict, tok, 1); /* fetch Size (a required field) from the trailer dictionary */ tok = dictentry(trailer, "Size");