diff options
-rw-r--r-- | source/pdf/pdf-xref.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index f9b72a4d..ef238fb1 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -2491,7 +2491,9 @@ void pdf_clear_xref(pdf_document *doc) { pdf_xref_entry *entry = &xref->table[e]; - if (entry->obj) + /* We cannot drop objects if the stream buffer has + * been updated */ + if (entry->obj != NULL && entry->stm_buf == NULL) { if (pdf_obj_refs(entry->obj) == 1) { @@ -2515,7 +2517,9 @@ void pdf_clear_xref_to_mark(pdf_document *doc) { pdf_xref_entry *entry = &xref->table[e]; - if (entry->obj) + /* We cannot drop objects if the stream buffer has + * been updated */ + if (entry->obj != NULL && entry->stm_buf == NULL) { if ((entry->flags & PDF_OBJ_FLAG_MARK) == 0 && pdf_obj_refs(entry->obj) == 1) { |