[poppler] poppler/XRef.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 26 18:24:38 UTC 2021


 poppler/XRef.cc |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit f35567dc6033cf8f856f5694af058fda2528cbe7
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 19 23:00:27 2021 +0200

    Fix XRef::copy when we have modified objects

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 3350f6e9..3e0e95fa 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -385,9 +385,16 @@ XRef *XRef::copy() const
     for (int i = 0; i < size; ++i) {
         xref->entries[i].offset = entries[i].offset;
         xref->entries[i].type = entries[i].type;
+        // set the object to null, it will be fetched from the stream when needed
         new (&xref->entries[i].obj) Object(objNull);
         xref->entries[i].flags = entries[i].flags;
         xref->entries[i].gen = entries[i].gen;
+
+        // If entry has been changed from the stream value we need to copy it
+        // otherwise it's lost
+        if (entries[i].getFlag(XRefEntry::Updated)) {
+            xref->entries[i].obj = entries[i].obj.copy();
+        }
     }
     xref->streamEndsLen = streamEndsLen;
     if (streamEndsLen != 0) {


More information about the poppler mailing list