diff options
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r-- | pdf/pdf_xref.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 41a7ba3a..102037f6 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -469,7 +469,11 @@ pdf_load_xref(pdf_document *xref, char *buf, int bufsize) for (i = 0; i < xref->len; i++) { if (xref->table[i].type == 'n') - if (xref->table[i].ofs <= 0 || xref->table[i].ofs >= xref->file_size) + /* Special case code: "0000000000 * f" means free, + * according to some producers (inc Quartz) */ + if (xref->table[i].ofs == 0) + xref->table[i].type = 'f'; + else if (xref->table[i].ofs <= 0 || xref->table[i].ofs >= xref->file_size) fz_throw(ctx, "object offset out of range: %d (%d 0 R)", xref->table[i].ofs, i); if (xref->table[i].type == 'o') if (xref->table[i].ofs <= 0 || xref->table[i].ofs >= xref->len || xref->table[xref->table[i].ofs].type != 'n') |