diff --git a/qpdf-compressed-object.patch b/qpdf-compressed-object.patch new file mode 100644 index 0000000..b1fbabe --- /dev/null +++ b/qpdf-compressed-object.patch @@ -0,0 +1,61 @@ +diff -urN ../qpdf-4.0.1.orig/ChangeLog ./ChangeLog +--- ../qpdf-4.0.1.orig/ChangeLog 2013-01-17 14:51:04.000000000 +0000 ++++ ./ChangeLog 2013-03-04 21:15:53.952108469 +0000 +@@ -1,3 +1,13 @@ ++2013-02-23 Jay Berkenbilt ++ ++ * Bug fix: properly handle overridden compressed objects. When ++ caching objects from an object stream, only cache objects that, ++ based on the xref table, would actually be resolved into this ++ stream. Prior to this fix, if an object stream A contained an ++ object B that was overridden by an appended section of the file, ++ qpdf would cache the old value of B if any non-overridden member ++ of A was accessed before B. This commit fixes that bug. ++ + 2013-01-17 Jay Berkenbilt + + * 4.0.1: release +diff -urN ../qpdf-4.0.1.orig/libqpdf/QPDF.cc ./libqpdf/QPDF.cc +--- ../qpdf-4.0.1.orig/libqpdf/QPDF.cc 2013-01-17 14:51:04.000000000 +0000 ++++ ./libqpdf/QPDF.cc 2013-03-04 21:15:53.952108469 +0000 +@@ -1538,20 +1538,31 @@ + offsets[num] = offset + first; + } + ++ // To avoid having to read the object stream multiple times, store ++ // all objects that would be found here in the cache. Remember ++ // that some objects stored here might have been overridden by new ++ // objects appended to the file, so it is necessary to recheck the ++ // xref table and only cache what would actually be resolved here. + for (std::map::iterator iter = offsets.begin(); + iter != offsets.end(); ++iter) + { + int obj = (*iter).first; +- int offset = (*iter).second; +- input->seek(offset, SEEK_SET); +- QPDFObjectHandle oh = readObject(input, "", obj, 0, true); +- +- // Store in cache + ObjGen og(obj, 0); +- +- this->obj_cache[og] = +- ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), +- end_before_space, end_after_space); ++ QPDFXRefEntry const& entry = this->xref_table[og]; ++ if ((entry.getType() == 2) && ++ (entry.getObjStreamNumber() == obj_stream_number)) ++ { ++ int offset = (*iter).second; ++ input->seek(offset, SEEK_SET); ++ QPDFObjectHandle oh = readObject(input, "", obj, 0, true); ++ this->obj_cache[og] = ++ ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), ++ end_before_space, end_after_space); ++ } ++ else ++ { ++ //QTC::TC("qpdf", "QPDF not caching overridden objstm object"); ++ } + } + } + diff --git a/qpdf-size_t.patch b/qpdf-size_t.patch new file mode 100644 index 0000000..6329b7f --- /dev/null +++ b/qpdf-size_t.patch @@ -0,0 +1,12 @@ +diff -urN ../qpdf-4.0.1.orig/qpdf/qpdf.cc ./qpdf/qpdf.cc +--- ../qpdf-4.0.1.orig/qpdf/qpdf.cc 2013-01-17 14:51:04.000000000 +0000 ++++ ./qpdf/qpdf.cc 2013-03-04 21:07:56.361335897 +0000 +@@ -1574,7 +1574,7 @@ + // This prevents those objects from being preserved by + // being referred to from other places, such as the + // outlines dictionary. +- for (int pageno = 0; pageno < (int)orig_pages.size(); ++pageno) ++ for (size_t pageno = 0; pageno < orig_pages.size(); ++pageno) + { + if (selected_from_orig.count(pageno) == 0) + { diff --git a/qpdf.spec b/qpdf.spec index c134c64..fa4ede4 100644 --- a/qpdf.spec +++ b/qpdf.spec @@ -1,12 +1,15 @@ Summary: Command-line tools and library for transforming PDF files Name: qpdf Version: 4.0.1 -Release: 2%{?dist} +Release: 3%{?dist} License: Artistic 2.0 Group: System Environment/Base URL: http://qpdf.sourceforge.net/ Source0: http://downloads.sourceforge.net/sourceforge/qpdf/qpdf-%{version}.tar.gz +Patch0: qpdf-size_t.patch +Patch1: qpdf-compressed-object.patch + BuildRequires: zlib-devel BuildRequires: pcre-devel @@ -58,6 +61,11 @@ QPDF Manual %prep %setup -q +# work around gcc 4.8.0 issue on ppc64 (#915321) +%patch0 -p1 -b .size_t +# properly handle overridden compressed objects +%patch1 -p1 -b .compressed-object + %build # work-around check-rpaths errors autoreconf --verbose --force --install @@ -102,6 +110,10 @@ make check %doc __doc/* %changelog +* Tue Mar 05 2013 Jiri Popelka - 4.0.1-3 +- work around gcc 4.8.0 issue on ppc64 (#915321) +- properly handle overridden compressed objects + * Thu Feb 14 2013 Fedora Release Engineering - 4.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild