diff --git a/.gitignore b/.gitignore index f82a50b..34767dd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ podofo-0.8.1.tar.gz /podofo-0.9.4.tar.gz /podofo-0.9.5.tar.gz /podofo-0.9.6.tar.gz +/podofo-0.9.7.tar.gz diff --git a/podofo-0.9.4-freetype.patch b/podofo-0.9.4-freetype.patch index a696eeb..04c1feb 100644 --- a/podofo-0.9.4-freetype.patch +++ b/podofo-0.9.4-freetype.patch @@ -1,7 +1,7 @@ -diff -rupN podofo-0.9.6/CMakeLists.txt podofo-0.9.6-new/CMakeLists.txt ---- podofo-0.9.6/CMakeLists.txt 2018-07-08 12:33:27.000000000 +0200 -+++ podofo-0.9.6-new/CMakeLists.txt 2019-03-13 23:15:12.088138762 +0100 -@@ -398,8 +398,8 @@ ENDIF(NOT PODOFO_BUILD_LIB_ONLY) +diff -rupN --no-dereference podofo-0.9.7/CMakeLists.txt podofo-0.9.7-new/CMakeLists.txt +--- podofo-0.9.7/CMakeLists.txt 2021-01-05 17:56:54.000000000 +0100 ++++ podofo-0.9.7-new/CMakeLists.txt 2021-01-09 20:24:45.274935094 +0100 +@@ -407,8 +407,8 @@ ENDIF(NOT PODOFO_BUILD_LIB_ONLY) FIND_PACKAGE(OpenSSL) @@ -12,10 +12,10 @@ diff -rupN podofo-0.9.6/CMakeLists.txt podofo-0.9.6-new/CMakeLists.txt FIND_PACKAGE(LIBSTLPORT) SET(stlport_libraries_if_use_stlport) -@@ -478,7 +478,7 @@ INCLUDE_DIRECTORIES(BEFORE # before tool +@@ -487,7 +487,7 @@ INCLUDE_DIRECTORIES(BEFORE # before tool INCLUDE_DIRECTORIES( - ${PoDoFo_SOURCE_DIR}/src + ${PoDoFo_SOURCE_DIR}/src/podofo - ${FREETYPE_INCLUDE_DIR} + ${FREETYPE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} diff --git a/podofo.spec b/podofo.spec index b98317e..488855a 100644 --- a/podofo.spec +++ b/podofo.spec @@ -1,6 +1,6 @@ Name: podofo -Version: 0.9.6 -Release: 13%{?dist} +Version: 0.9.7 +Release: 1%{?dist} Summary: Tools and libraries to work with the PDF file format # The library is licensed under the LGPL. @@ -11,48 +11,13 @@ URL: http://podofo.sourceforge.net Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz # Fix failure to detect FreeType Patch0: podofo-0.9.4-freetype.patch -# Don't attempt to copy non-existing testdata dir -Patch1: podofo_tests.patch -# Fix pkg-config file -Patch2: podofo_pkgconfig.patch - -# Backport patch for CVE-2018-5783 -# https://sourceforge.net/p/podofo/code/1949 -Patch10: podofo_CVE-2018-5783.patch -# Backport patch for CVE-2018-11254 -# https://sourceforge.net/p/podofo/code/1941 -Patch11: podofo_CVE-2018-11254.patch -# Backport patch for CVE-2018-11255 -# https://sourceforge.net/p/podofo/code/1952 -Patch12: podofo_CVE-2018-11255.patch -# Backport patch for CVE-2018-11256 -# https://sourceforge.net/p/podofo/code/1938 -Patch13: podofo_CVE-2018-11256.patch -# Backport patch for CVE-2018-12982 -# https://sourceforge.net/p/podofo/code/1948 -Patch14: podofo_CVE-2018-12982.patch -# Backport patch for CVE-2018-14320 -# https://sourceforge.net/p/podofo/code/1953 -Patch15: podofo_CVE-2018-14320.patch -# Backport patch for CVE-2018-19532 -# https://sourceforge.net/p/podofo/code/1950 -Patch16: podofo_CVE-2018-19532.patch -# Backport patch for CVE-2018-20751 -# https://sourceforge.net/p/podofo/code/1954 -Patch17: podofo_CVE-2018-20751.patch -# Backport patch for CVE-2019-9199 -# https://sourceforge.net/p/podofo/code/1971/ -Patch18: podofo_CVE-2019-9199.patch -# Backport patch for CVE-2019-9687 -# https://sourceforge.net/p/podofo/code/1969 -Patch19: podofo_CVE-2019-9687.patch # Downstream patch for CVE-2019-20093 # https://sourceforge.net/p/podofo/tickets/75/ Patch20: podofo_CVE-2019-20093.patch # Proposed patch for CVE-2018-12983 # https://sourceforge.net/p/podofo/tickets/23/ -Patch21: podofo_CVE-2018-12983.diff +Patch21: podofo_CVE-2018-12983.patch # https://sourceforge.net/p/podofo/tickets/101/ Patch22: podofo_maxbytes.patch @@ -152,7 +117,7 @@ find doc/html -exec touch -r %{SOURCE0} {} \; %files libs %doc AUTHORS ChangeLog FAQ.html README.html TODO %license COPYING.LIB COPYING.exception -%{_libdir}/*.so.0.9.6 +%{_libdir}/*.so.0.9.7 %files devel %doc doc/html examples @@ -162,6 +127,9 @@ find doc/html -exec touch -r %{SOURCE0} {} \; %changelog +* Sat Jan 09 2021 Sandro Mani - 0.9.7-1 +- Update to 0.9.7 + * Tue Jul 28 2020 Fedora Release Engineering - 0.9.6-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/podofo_CVE-2018-11254.patch b/podofo_CVE-2018-11254.patch deleted file mode 100644 index 88c84c2..0000000 --- a/podofo_CVE-2018-11254.patch +++ /dev/null @@ -1,1000 +0,0 @@ -diff -rupN podofo-0.9.6/src/doc/PdfPagesTree.cpp podofo-0.9.6-new/src/doc/PdfPagesTree.cpp ---- podofo-0.9.6/src/doc/PdfPagesTree.cpp 2018-02-25 23:36:48.000000000 +0100 -+++ podofo-0.9.6-new/src/doc/PdfPagesTree.cpp 2019-03-13 23:15:12.173138741 +0100 -@@ -51,7 +51,7 @@ PdfPagesTree::PdfPagesTree( PdfVecObject - : PdfElement( "Pages", pParent ), - m_cache( 0 ) - { -- GetObject()->GetDictionary().AddKey( "Kids", PdfArray() ); // kids->Reference() -+ GetObject()->GetDictionary().AddKey( "Kids", PdfArray() ); // kids->Reference() - GetObject()->GetDictionary().AddKey( "Count", PdfObject( static_cast(PODOFO_LL_LITERAL(0)) ) ); - } - -@@ -59,13 +59,13 @@ PdfPagesTree::PdfPagesTree( PdfObject* p - : PdfElement( "Pages", pPagesRoot ), - m_cache( GetChildCount( pPagesRoot ) ) - { -- if( !this->GetObject() ) -+ if( !this->GetObject() ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); - } - } - --PdfPagesTree::~PdfPagesTree() -+PdfPagesTree::~PdfPagesTree() - { - m_cache.ClearCache(); - } -@@ -90,7 +90,7 @@ PdfPage* PdfPagesTree::GetPage( int nInd - // Not in cache -> search tree - PdfObjectList lstParents; - PdfObject* pObj = this->GetPageNode(nIndex, this->GetRoot(), lstParents); -- if( pObj ) -+ if( pObj ) - { - pPage = new PdfPage( pObj, lstParents ); - m_cache.AddPageObject( nIndex, pPage ); -@@ -105,13 +105,13 @@ PdfPage* PdfPagesTree::GetPage( const Pd - // We have to search through all pages, - // as this is the only way - // to instantiate the PdfPage with a correct list of parents -- for( int i=0;iGetTotalNumberOfPages();i++ ) -+ for( int i=0;iGetTotalNumberOfPages();i++ ) - { - PdfPage* pPage = this->GetPage( i ); -- if( pPage && pPage->GetObject()->Reference() == ref ) -+ if( pPage && pPage->GetObject()->Reference() == ref ) - return pPage; - } -- -+ - return NULL; - } - -@@ -130,7 +130,7 @@ void PdfPagesTree::InsertPage( int nAfte - bInsertBefore = true; - nAfterPageIndex = 0; - } -- else if( nAfterPageIndex < 0 ) -+ else if( nAfterPageIndex < 0 ) - { - // Only ePdfPageInsertionPoint_InsertBeforeFirstPage is valid here - PdfError::LogMessage( eLogSeverity_Information, -@@ -149,9 +149,9 @@ void PdfPagesTree::InsertPage( int nAfte - lstParents ); - } - //printf("pPageBefore=%p lstParents=%i\n", pPageBefore,lstParents.size() ); -- if( !pPageBefore || lstParents.size() == 0 ) -+ if( !pPageBefore || lstParents.size() == 0 ) - { -- if( this->GetTotalNumberOfPages() != 0 ) -+ if( this->GetTotalNumberOfPages() != 0 ) - { - PdfError::LogMessage( eLogSeverity_Critical, - "Cannot find page %i or page %i has no parents. Cannot insert new page.", -@@ -188,7 +188,7 @@ void PdfPagesTree::InsertPages( int nAft - bInsertBefore = true; - nAfterPageIndex = 0; - } -- else if( nAfterPageIndex < 0 ) -+ else if( nAfterPageIndex < 0 ) - { - // Only ePdfPageInsertionPoint_InsertBeforeFirstPage is valid here - PdfError::LogMessage( eLogSeverity_Information, -@@ -204,9 +204,9 @@ void PdfPagesTree::InsertPages( int nAft - pPageBefore = this->GetPageNode( nAfterPageIndex, this->GetRoot(), - lstParents ); - } -- if( !pPageBefore || lstParents.size() == 0 ) -+ if( !pPageBefore || lstParents.size() == 0 ) - { -- if( this->GetTotalNumberOfPages() != 0 ) -+ if( this->GetTotalNumberOfPages() != 0 ) - { - PdfError::LogMessage( eLogSeverity_Critical, - "Cannot find page %i or page %i has no parents. Cannot insert new page.", -@@ -239,7 +239,7 @@ PdfPage* PdfPagesTree::CreatePage( const - - InsertPage( this->GetTotalNumberOfPages() - 1, pPage ); - m_cache.AddPageObject( this->GetTotalNumberOfPages(), pPage ); -- -+ - return pPage; - } - -@@ -278,12 +278,12 @@ void PdfPagesTree::DeletePage( int nPage - { - // Delete from cache - m_cache.DeletePage( nPageNumber ); -- -+ - // Delete from pages tree - PdfObjectList lstParents; - PdfObject* pPageNode = this->GetPageNode( nPageNumber, this->GetRoot(), lstParents ); - -- if( !pPageNode ) -+ if( !pPageNode ) - { - PdfError::LogMessage( eLogSeverity_Information, - "Invalid argument to PdfPagesTree::DeletePage: %i - Page not found\n", -@@ -291,11 +291,11 @@ void PdfPagesTree::DeletePage( int nPage - PODOFO_RAISE_ERROR( ePdfError_PageNotFound ); - } - -- if( lstParents.size() > 0 ) -+ if( lstParents.size() > 0 ) - { - PdfObject* pParent = lstParents.back(); - int nKidsIndex = this->GetPosInKids( pPageNode, pParent ); -- -+ - DeletePageFromNode( pParent, lstParents, nKidsIndex, pPageNode ); - } - else -@@ -312,10 +312,10 @@ void PdfPagesTree::DeletePage( int nPage - // Private methods - //////////////////////////////////////////////////// - --PdfObject* PdfPagesTree::GetPageNode( int nPageNum, PdfObject* pParent, -- PdfObjectList & rLstParents ) -+PdfObject* PdfPagesTree::GetPageNode( int nPageNum, PdfObject* pParent, -+ PdfObjectList & rLstParents ) - { -- if( !pParent ) -+ if( !pParent ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); - } -@@ -325,21 +325,20 @@ PdfObject* PdfPagesTree::GetPageNode( in - PODOFO_RAISE_ERROR( ePdfError_InvalidKey ); - } - -- -+ - const PdfObject* pObj = pParent->GetIndirectKey( "Kids" ); - if( pObj == NULL || !pObj->IsArray() ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); - } - -- const PdfArray & rKidsArray = pObj->GetArray(); -+ const PdfArray & rKidsArray = pObj->GetArray(); - PdfArray::const_iterator it = rKidsArray.begin(); - -- const size_t numDirectKids = rKidsArray.size(); - const size_t numKids = GetChildCount(pParent); - - // use <= since nPageNum is 0-based -- if( static_cast(numKids) <= nPageNum ) -+ if( static_cast(numKids) <= nPageNum ) - { - PdfError::LogMessage( eLogSeverity_Critical, - "Cannot retrieve page %i from a document with only %i pages.", -@@ -347,92 +346,71 @@ PdfObject* PdfPagesTree::GetPageNode( in - return NULL; - } - -- //printf("Fetching: %i %i %i\n", numDirectKids, numKids, nPageNum ); -- if( numDirectKids == numKids && static_cast(nPageNum) < numDirectKids ) -- { -- // This node has only page nodes as kids, -- // so we can access the array directly -- rLstParents.push_back( pParent ); -- return GetPageNodeFromArray( nPageNum, rKidsArray, rLstParents ); -- } -- else -- { -- // We have to traverse the tree -- while( it != rKidsArray.end() ) -- { -- if( (*it).IsArray() ) -- { // Fixes PDFs broken by having trees with arrays nested once -- -- rLstParents.push_back( pParent ); -- -- // the following code is to find the reference to log this with -- const PdfReference & rIterArrayRef = (*it).Reference(); -- PdfReference refToLog; -- bool isDirectObject // don't worry about 0-num. indirect ones -- = ( !(rIterArrayRef.ObjectNumber() ) ); -- if ( isDirectObject ) -- { -- if ( !(pObj->Reference().ObjectNumber() ) ) // rKidsArray's -- { -- refToLog = pParent->Reference(); -- } -- else -- { -- refToLog = pObj->Reference(); -- } -- } -- else -- { -- refToLog = rIterArrayRef; -- } -- PdfError::LogMessage( eLogSeverity_Error, -- "Entry in Kids array is itself an array" -- "%s reference: %s\n", isDirectObject ? " (direct object)" -- ", in object with" : ",", refToLog.ToString().c_str() ); -+ //printf("Fetching: %i %i\n", numKids, nPageNum ); - -- const PdfArray & rIterArray = (*it).GetArray(); -+ // We have to traverse the tree -+ // -+ // BEWARE: There is no valid shortcut for tree traversal. -+ // Even if eKidsArray.size()==numKids, this does not imply that -+ // eKidsArray can be accessed with the index of the page directly. -+ // The tree could have an arbitrary complex structure because -+ // internal nodes with no leaves (page objects) are not forbidden -+ // by the PDF spec. -+ while( it != rKidsArray.end() ) -+ { -+ if(!(*it).IsReference() ) -+ { -+ PdfError::LogMessage( eLogSeverity_Critical, "Requesting page index %i. Invalid datatype in kids array: %s\n", -+ nPageNum, (*it).GetDataTypeString()); -+ return NULL; -+ } - -- // is the array large enough to potentially have the page? -- if( static_cast(nPageNum) < rIterArray.GetSize() ) -- { -- PdfObject* pPageNode = GetPageNodeFromArray( nPageNum, -- rIterArray, rLstParents ); -- if ( pPageNode ) // and if not, search further -- return pPageNode; -- } -- } -- else if( (*it).IsReference() ) -- { - PdfObject* pChild = GetRoot()->GetOwner()->GetObject( (*it).GetReference() ); -- if (!pChild) -+ if (!pChild) - { -- PdfError::LogMessage( eLogSeverity_Critical, "Requesting page index %i. Child not found: %s\n", -- nPageNum, (*it).GetReference().ToString().c_str()); -+ PdfError::LogMessage( eLogSeverity_Critical, "Requesting page index %i. Child not found: %s\n", -+ nPageNum, (*it).GetReference().ToString().c_str()); - return NULL; - } - -- if( this->IsTypePages(pChild) ) -+ if( this->IsTypePages(pChild) ) - { - int childCount = GetChildCount( pChild ); - if( childCount < nPageNum + 1 ) // Pages are 0 based, but count is not - { -- // skip this page node -- // and go to the next one -+ // skip this page tree node -+ // and go to the next child in rKidsArray - nPageNum -= childCount; - } - else - { -+ // page is in the subtree of pChild -+ // => call GetPageNode() recursively -+ - rLstParents.push_back( pParent ); -+ -+ if ( std::find( rLstParents.begin(), rLstParents.end(), pChild ) -+ != rLstParents.end() ) // cycle in parent list detected, fend -+ { // off security vulnerability similar to CVE-2017-8054 (infinite recursion) -+ std::ostringstream oss; -+ oss << "Cycle in page tree: child in /Kids array of object " -+ << ( *(rLstParents.rbegin()) )->Reference().ToString() -+ << " back-references to object " << pChild->Reference() -+ .ToString() << " one of whose descendants the former is."; -+ PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, oss.str() ); -+ } -+ - return this->GetPageNode( nPageNum, pChild, rLstParents ); - } - } -- else if( this->IsTypePage(pChild) ) -+ else if( this->IsTypePage(pChild) ) - { - if( 0 == nPageNum ) - { -+ // page found - rLstParents.push_back( pParent ); - return pChild; -- } -+ } - - // Skip a normal page - if(nPageNum > 0 ) -@@ -448,100 +426,16 @@ PdfObject* PdfPagesTree::GetPageNode( in - "Invalid datatype referenced in kids array: %s\n" - "Reference to invalid object: %i %i R\n", nPageNum, - pChild->GetDataTypeString(), nLogObjNum, nLogGenNum); -+ return NULL; - } -- } -- else -- { -- PdfError::LogMessage( eLogSeverity_Critical, "Requesting page index %i. Invalid datatype in kids array: %s\n", -- nPageNum, (*it).GetDataTypeString()); -- return NULL; -- } -- -- ++it; -- } -- } -- -- return NULL; --} -- --PdfObject* PdfPagesTree::GetPageNodeFromArray( int nPageNum, const PdfArray & rKidsArray, PdfObjectList & rLstParents ) --{ -- if( static_cast(nPageNum) >= rKidsArray.GetSize() ) -- { -- PdfError::LogMessage( eLogSeverity_Critical, "Requesting page index %i from array of size %i\n", -- nPageNum, rKidsArray.size() ); -- return NULL; -- } -- -- // TODO: Fill cache immediately with all pages -- // in this kids array -- PdfVariant rVar = rKidsArray[nPageNum]; -- while( true ) -- { -- if( rVar.IsArray() ) -- { -- // Fixes some broken PDFs who have trees with 1 element kids arrays -- // Recursive call removed to prevent stack overflow (CVE-2017-8054) -- // replaced by the following inside this conditional incl. continue -- const PdfArray & rVarArray = rVar.GetArray(); -- if (rVarArray.GetSize() == 0) -- { -- PdfError::LogMessage( eLogSeverity_Critical, "Trying to access" -- " first page index of empty array" ); -- return NULL; -- } -- PdfVariant rVarFirstEntry = rVarArray[0]; // avoids use-after-free -- rVar = rVarFirstEntry; // in this line (rVar-ref'd array is freed) -- continue; -- } -- else if( !rVar.IsReference() ) -- { -- PODOFO_RAISE_ERROR_INFO( ePdfError_NotImplemented, "Cannot handle inline pages." ); -- } -- -- PdfObject* pgObject = GetRoot()->GetOwner()->GetObject( rVar.GetReference() ); -- if(pgObject==NULL) -- { -- PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, "Invalid reference." ); -- } -- -- //printf("Reading %s\n", pgObject->Reference().ToString().c_str()); -- // make sure the object is a /Page and not a /Pages with a single kid -- if( this->IsTypePage(pgObject) ) -- { -- return pgObject; -- } - -- // it's a /Pages with a single kid, so dereference and try again... -- if (this->IsTypePages(pgObject) ) -- { -- if( !pgObject->GetDictionary().HasKey( "Kids" ) ) -- return NULL; -- -- if ( std::find( rLstParents.begin(), rLstParents.end(), pgObject ) -- != rLstParents.end() ) // cycle in parent list detected, fend -- { // off security vulnerability CVE-2017-8054 (infinite recursion) -- std::ostringstream oss; -- oss << "Cycle in page tree: child in /Kids array of object " -- << ( *(rLstParents.rbegin()) )->Reference().ToString() -- << " back-references to object " << pgObject->Reference() -- .ToString() << " one of whose descendants the former is."; -- -- PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, oss.str() ); -- } -- -- rLstParents.push_back( pgObject ); -- rVar = *(pgObject->GetDictionary().GetKey( "Kids" )); -- } else { -- // Reference to unexpected object -- PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, "Reference to unexpected object." ); -+ ++it; - } -- } - - return NULL; - } - --bool PdfPagesTree::IsTypePage(const PdfObject* pObject) const -+bool PdfPagesTree::IsTypePage(const PdfObject* pObject) const - { - if( !pObject ) - return false; -@@ -552,7 +446,7 @@ bool PdfPagesTree::IsTypePage(const PdfO - return false; - } - --bool PdfPagesTree::IsTypePages(const PdfObject* pObject) const -+bool PdfPagesTree::IsTypePages(const PdfObject* pObject) const - { - if( !pObject ) - return false; -@@ -565,12 +459,12 @@ bool PdfPagesTree::IsTypePages(const Pdf - - int PdfPagesTree::GetChildCount( const PdfObject* pNode ) const - { -- if( !pNode ) -+ if( !pNode ) - return 0; - - const PdfObject *pCount = pNode->GetIndirectKey( "Count" ); - if( pCount != 0 ) { -- return (pCount->GetDataType() == PoDoFo::ePdfDataType_Number) ? -+ return (pCount->GetDataType() == PoDoFo::ePdfDataType_Number) ? - static_cast( pCount->GetNumber() ):0; - } else { - return 0; -@@ -589,7 +483,7 @@ int PdfPagesTree::GetPosInKids( PdfObjec - PdfArray::const_iterator it = rKids.begin(); - - int index = 0; -- while( it != rKids.end() ) -+ while( it != rKids.end() ) - { - if( (*it).GetReference() == pPageObj->Reference() ) - { -@@ -606,10 +500,10 @@ int PdfPagesTree::GetPosInKids( PdfObjec - return -1; - } - --void PdfPagesTree::InsertPageIntoNode( PdfObject* pParent, const PdfObjectList & rlstParents, -+void PdfPagesTree::InsertPageIntoNode( PdfObject* pParent, const PdfObjectList & rlstParents, - int nIndex, PdfObject* pPage ) - { -- if( !pParent || !pPage ) -+ if( !pParent || !pPage ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); - } -@@ -625,17 +519,17 @@ void PdfPagesTree::InsertPageIntoNode( P - - newKids.reserve( oldKids.GetSize() + 1 ); - -- if( nIndex < 0 ) -+ if( nIndex < 0 ) - { - newKids.push_back( pPage->Reference() ); - } - - int i = 0; -- while( it != oldKids.end() ) -+ while( it != oldKids.end() ) - { - newKids.push_back( *it ); - -- if( i == nIndex ) -+ if( i == nIndex ) - newKids.push_back( pPage->Reference() ); - - ++i; -@@ -650,7 +544,7 @@ void PdfPagesTree::InsertPageIntoNode( P - */ - - pParent->GetDictionary().AddKey( PdfName("Kids"), newKids ); -- -+ - // 2. increase count - PdfObjectList::const_reverse_iterator itParents = rlstParents.rbegin(); - while( itParents != rlstParents.rend() ) -@@ -658,16 +552,16 @@ void PdfPagesTree::InsertPageIntoNode( P - this->ChangePagesCount( *itParents, 1 ); - - ++itParents; -- } -+ } - - // 3. add parent key to the page - pPage->GetDictionary().AddKey( PdfName("Parent"), pParent->Reference() ); - } - --void PdfPagesTree::InsertPagesIntoNode( PdfObject* pParent, const PdfObjectList & rlstParents, -+void PdfPagesTree::InsertPagesIntoNode( PdfObject* pParent, const PdfObjectList & rlstParents, - int nIndex, const std::vector& vecPages ) - { -- if( !pParent || !vecPages.size() ) -+ if( !pParent || !vecPages.size() ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); - } -@@ -683,7 +577,7 @@ void PdfPagesTree::InsertPagesIntoNode( - - bool bIsPushedIn = false; - int i=0; -- for (PdfArray::const_iterator it=oldKids.begin(); it!=oldKids.end(); ++it, ++i ) -+ for (PdfArray::const_iterator it=oldKids.begin(); it!=oldKids.end(); ++it, ++i ) - { - if ( !bIsPushedIn && (nIndex < i) ) // Pushing before - { -@@ -697,7 +591,7 @@ void PdfPagesTree::InsertPagesIntoNode( - } - - // If new kids are still not pushed in then they may be appending to the end -- if ( !bIsPushedIn && ( (nIndex + 1) == static_cast(oldKids.size())) ) -+ if ( !bIsPushedIn && ( (nIndex + 1) == static_cast(oldKids.size())) ) - { - for (std::vector::const_iterator itPages=vecPages.begin(); itPages!=vecPages.end(); ++itPages) - { -@@ -707,13 +601,13 @@ void PdfPagesTree::InsertPagesIntoNode( - } - - pParent->GetDictionary().AddKey( PdfName("Kids"), newKids ); -- -+ - - // 2. increase count - for ( PdfObjectList::const_reverse_iterator itParents = rlstParents.rbegin(); itParents != rlstParents.rend(); ++itParents ) - { - this->ChangePagesCount( *itParents, vecPages.size() ); -- } -+ } - - // 3. add parent key to each of the pages - for (std::vector::const_iterator itPages=vecPages.begin(); itPages!=vecPages.end(); ++itPages) -@@ -722,10 +616,10 @@ void PdfPagesTree::InsertPagesIntoNode( - } - } - --void PdfPagesTree::DeletePageFromNode( PdfObject* pParent, const PdfObjectList & rlstParents, -+void PdfPagesTree::DeletePageFromNode( PdfObject* pParent, const PdfObjectList & rlstParents, - int nIndex, PdfObject* pPage ) - { -- if( !pParent || !pPage ) -+ if( !pParent || !pPage ) - { - PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); - } -@@ -746,14 +640,14 @@ void PdfPagesTree::DeletePageFromNode( P - this->ChangePagesCount( *itParents, -1 ); - - ++itParents; -- } -+ } - - // 3. Remove empty pages nodes - itParents = rlstParents.rbegin(); - while( itParents != rlstParents.rend() ) - { - // Never delete root node -- if( IsEmptyPageNode( *itParents ) && *itParents != GetRoot() ) -+ if( IsEmptyPageNode( *itParents ) && *itParents != GetRoot() ) - { - PdfObject* pParentOfNode = *(itParents + 1); - int nKidsIndex = this->GetPosInKids( *itParents, pParentOfNode ); -@@ -764,10 +658,10 @@ void PdfPagesTree::DeletePageFromNode( P - } - - ++itParents; -- } -+ } - } - --void PdfPagesTree::DeletePageNode( PdfObject* pParent, int nIndex ) -+void PdfPagesTree::DeletePageNode( PdfObject* pParent, int nIndex ) - { - PdfArray kids = pParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray(); - kids.erase( kids.begin() + nIndex ); -@@ -779,7 +673,7 @@ int PdfPagesTree::ChangePagesCount( PdfO - // Increment or decrement inPagesDict's Count by inDelta, and return the new count. - // Simply return the current count if inDelta is 0. - int cnt = GetChildCount( pPageObj ); -- if( 0 != nDelta ) -+ if( 0 != nDelta ) - { - cnt += nDelta ; - pPageObj->GetDictionary().AddKey( "Count", PdfVariant( static_cast(cnt) ) ); -@@ -788,7 +682,7 @@ int PdfPagesTree::ChangePagesCount( PdfO - return cnt ; - } - --bool PdfPagesTree::IsEmptyPageNode( PdfObject* pPageNode ) -+bool PdfPagesTree::IsEmptyPageNode( PdfObject* pPageNode ) - { - long lCount = GetChildCount( pPageNode ); - bool bKidsEmpty = true; -@@ -802,7 +696,7 @@ bool PdfPagesTree::IsEmptyPageNode( PdfO - } - - /* --PdfObject* PdfPagesTree::GetPageNode( int nPageNum, PdfObject* pPagesObject, -+PdfObject* PdfPagesTree::GetPageNode( int nPageNum, PdfObject* pPagesObject, - std::deque & rListOfParents ) - { - // recurse through the pages tree nodes -@@ -835,9 +729,9 @@ PdfObject* PdfPagesTree::GetPageNode( in - } - - PdfVariant pgVar = kidsArray[ nPageNum ]; -- while ( true ) -+ while ( true ) - { -- if ( pgVar.IsArray() ) -+ if ( pgVar.IsArray() ) - { - // Fixes some broken PDFs who have trees with 1 element kids arrays - return GetPageNodeFromTree( nPageNum, pgVar.GetArray(), rListOfParents ); -@@ -857,8 +751,8 @@ PdfObject* PdfPagesTree::GetPageNode( in - rListOfParents.push_back( pgObject ); - pgVar = *(pgObject->GetDictionary().GetKey( "Kids" )); - } -- } -- else -+ } -+ else - { - return GetPageNodeFromTree( nPageNum, kidsArray, rListOfParents ); - } -diff -rupN podofo-0.9.6/src/doc/PdfPagesTree.h podofo-0.9.6-new/src/doc/PdfPagesTree.h ---- podofo-0.9.6/src/doc/PdfPagesTree.h 2014-06-15 14:27:46.000000000 +0200 -+++ podofo-0.9.6-new/src/doc/PdfPagesTree.h 2019-03-13 23:15:12.174138740 +0100 -@@ -190,7 +190,6 @@ class PODOFO_DOC_API PdfPagesTree : publ - PdfPagesTree(); // don't allow construction from nothing! - - PdfObject* GetPageNode( int nPageNum, PdfObject* pParent, PdfObjectList & rLstParents ); -- PdfObject* GetPageNodeFromArray( int nPageNum, const PdfArray & rKidsArray, PdfObjectList & rLstParents ); - - int GetChildCount( const PdfObject* pNode ) const; - -diff -rupN podofo-0.9.6/test/unit/PagesTreeTest.cpp podofo-0.9.6-new/test/unit/PagesTreeTest.cpp ---- podofo-0.9.6/test/unit/PagesTreeTest.cpp 2016-05-12 22:08:20.000000000 +0200 -+++ podofo-0.9.6-new/test/unit/PagesTreeTest.cpp 2019-03-13 23:15:12.174138740 +0100 -@@ -22,6 +22,8 @@ - - #include - -+#include -+ - #define PODOFO_TEST_PAGE_KEY "PoDoFoTestPageNumber" - #define PODOFO_TEST_NUM_PAGES 100 - -@@ -70,6 +72,58 @@ void PagesTreeTest::testEmptyDoc() - CPPUNIT_ASSERT_THROW( writer.GetPage( 1 ), PdfError ); - } - -+void PagesTreeTest::testCyclicTree() -+{ -+ for (int pass=0; pass < 2; pass++) -+ { -+ PdfMemDocument doc; -+ CreateCyclicTree( doc, pass==1); -+ //doc.Write(pass==0?"tree_valid.pdf":"tree_cyclic.pdf"); -+ for (int pagenum=0; pagenum < doc.GetPageCount(); pagenum++) -+ { -+ if (pass==0) -+ { -+ // pass 0: -+ // valid tree without cycles should yield all pages -+ PdfPage* pPage = doc.GetPage( pagenum ); -+ CPPUNIT_ASSERT_EQUAL( pPage != NULL, true ); -+ CPPUNIT_ASSERT_EQUAL( IsPageNumber( pPage, pagenum ), true ); -+ } -+ else -+ { -+ // pass 1: -+ // cyclic tree must throw exception to prevent infinite recursion -+ CPPUNIT_ASSERT_THROW( doc.GetPage( pagenum ), PdfError ); -+ } -+ } -+ } -+} -+ -+void PagesTreeTest::testEmptyKidsTree() -+{ -+ PdfMemDocument doc; -+ CreateEmptyKidsTree(doc); -+ //doc.Write("tree_zerokids.pdf"); -+ for (int pagenum=0; pagenum < doc.GetPageCount(); pagenum++) -+ { -+ PdfPage* pPage = doc.GetPage( pagenum ); -+ CPPUNIT_ASSERT_EQUAL( pPage != NULL, true ); -+ CPPUNIT_ASSERT_EQUAL( IsPageNumber( pPage, pagenum ), true ); -+ } -+} -+ -+void PagesTreeTest::testNestedArrayTree() -+{ -+ PdfMemDocument doc; -+ CreateNestedArrayTree(doc); -+ //doc.Write("tree_nested_array.pdf"); -+ for (int pagenum=0; pagenum < doc.GetPageCount(); pagenum++) -+ { -+ PdfPage* pPage = doc.GetPage( pagenum ); -+ CPPUNIT_ASSERT_EQUAL( pPage == NULL, true ); -+ } -+} -+ - void PagesTreeTest::testCreateDelete() - { - PdfMemDocument writer; -@@ -354,6 +408,152 @@ void PagesTreeTest::CreateTestTreeCustom - pRoot->GetDictionary().AddKey( PdfName("Count"), static_cast(PODOFO_TEST_NUM_PAGES) ); - } - -+std::vector PagesTreeTest::CreateSamplePages( PdfMemDocument & rDoc, -+ int nPageCount) -+{ -+ PdfFont* pFont; -+ -+ // create font -+ pFont = rDoc.CreateFont( "Arial" ); -+ if( !pFont ) -+ { -+ PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); -+ } -+ pFont->SetFontSize( 16.0 ); -+ -+ std::vector pPage(nPageCount); -+ for (int i = 0; i < nPageCount; ++i) -+ { -+ pPage[i] = new PdfPage( PdfPage::CreateStandardPageSize( ePdfPageSize_A4 ), -+ &(rDoc.GetObjects()) ); -+ pPage[i]->GetObject()->GetDictionary().AddKey( PODOFO_TEST_PAGE_KEY, -+ static_cast(i) ); -+ -+ PdfPainter painter; -+ painter.SetPage( pPage[i] ); -+ painter.SetFont( pFont ); -+ std::ostringstream os; -+ os << "Page " << i+1; -+ painter.DrawText( 200, 200, os.str() ); -+ painter.FinishPage(); -+ } -+ -+ return pPage; -+} -+ -+std::vector PagesTreeTest::CreateNodes( PdfMemDocument & rDoc, -+ int nNodeCount) -+{ -+ std::vector pNode(nNodeCount); -+ -+ for (int i = 0; i < nNodeCount; ++i) -+ { -+ pNode[i]=rDoc.GetObjects().CreateObject("Pages"); -+ // init required keys -+ pNode[i]->GetDictionary().AddKey( "Kids", PdfArray()); -+ pNode[i]->GetDictionary().AddKey( "Count", PdfVariant(static_cast(0L))); -+ } -+ -+ return pNode; -+} -+ -+void PagesTreeTest::CreateCyclicTree( PoDoFo::PdfMemDocument & rDoc, -+ bool bCreateCycle ) -+{ -+ const int COUNT = 3; -+ -+ std::vector pPage=CreateSamplePages( rDoc, COUNT ); -+ std::vector pNode=CreateNodes( rDoc, 2 ); -+ -+ // manually insert pages into pagetree -+ PdfObject* pRoot = rDoc.GetPagesTree()->GetObject(); -+ -+ // tree layout (for !bCreateCycle): -+ // -+ // root -+ // +-- node0 -+ // +-- node1 -+ // | +-- page0 -+ // | +-- page1 -+ // \-- page2 -+ -+ // root node -+ AppendChildNode(pRoot, pNode[0]); -+ -+ // tree node 0 -+ AppendChildNode(pNode[0], pNode[1]); -+ AppendChildNode(pNode[0], pPage[2]->GetObject()); -+ -+ // tree node 1 -+ AppendChildNode(pNode[1], pPage[0]->GetObject()); -+ AppendChildNode(pNode[1], pPage[1]->GetObject()); -+ -+ if (bCreateCycle) -+ { -+ // invalid tree: Cycle!!! -+ // was not detected in PdfPagesTree::GetPageNode() rev. 1937 -+ pNode[0]->GetIndirectKey("Kids")->GetArray()[0]=pRoot->Reference(); -+ } -+} -+ -+void PagesTreeTest::CreateEmptyKidsTree( PoDoFo::PdfMemDocument & rDoc ) -+{ -+ const int COUNT = 3; -+ -+ std::vector pPage=CreateSamplePages( rDoc, COUNT ); -+ std::vector pNode=CreateNodes( rDoc, 3 ); -+ -+ // manually insert pages into pagetree -+ PdfObject* pRoot = rDoc.GetPagesTree()->GetObject(); -+ -+ // tree layout: -+ // -+ // root -+ // +-- node0 -+ // | +-- page0 -+ // | +-- page1 -+ // | +-- page2 -+ // +-- node1 -+ // \-- node2 -+ -+ // root node -+ AppendChildNode(pRoot, pNode[0]); -+ AppendChildNode(pRoot, pNode[1]); -+ AppendChildNode(pRoot, pNode[2]); -+ -+ // tree node 0 -+ AppendChildNode(pNode[0], pPage[0]->GetObject()); -+ AppendChildNode(pNode[0], pPage[1]->GetObject()); -+ AppendChildNode(pNode[0], pPage[2]->GetObject()); -+ -+ // tree node 1 and node 2 are left empty: this is completely valid -+ // according to the PDF spec, i.e. the required keys may have the -+ // values "/Kids [ ]" and "/Count 0" -+} -+ -+void PagesTreeTest::CreateNestedArrayTree( PoDoFo::PdfMemDocument & rDoc ) -+{ -+ const int COUNT = 3; -+ -+ std::vector pPage=CreateSamplePages( rDoc, COUNT ); -+ PdfObject* pRoot = rDoc.GetPagesTree()->GetObject(); -+ -+ // create kids array -+ PdfArray kids; -+ for (int i=0; i < COUNT; i++) -+ { -+ kids.push_back( pPage[i]->GetObject()->Reference() ); -+ pPage[i]->GetObject()->GetDictionary().AddKey( PdfName("Parent"), pRoot->Reference()); -+ } -+ -+ // create nested kids array -+ PdfArray nested; -+ nested.push_back(kids); -+ -+ // manually insert pages into pagetree -+ pRoot->GetDictionary().AddKey( PdfName("Count"), static_cast(COUNT) ); -+ pRoot->GetDictionary().AddKey( PdfName("Kids"), nested); -+} - - bool PagesTreeTest::IsPageNumber( PoDoFo::PdfPage* pPage, int nNumber ) - { -@@ -367,3 +567,33 @@ bool PagesTreeTest::IsPageNumber( PoDoFo - else - return true; - } -+ -+void PagesTreeTest::AppendChildNode(PdfObject* pParent, PdfObject* pChild) -+{ -+ // 1. Add the reference of the new child to the kids array of pParent -+ PdfArray kids; -+ PdfObject* oldKids=pParent->GetIndirectKey("Kids"); -+ if (oldKids && oldKids->IsArray()) kids=oldKids->GetArray(); -+ kids.push_back(pChild->Reference()); -+ pParent->GetDictionary().AddKey( PdfName("Kids"), kids); -+ -+ // 2. If the child is a page (leaf node), increase count of every parent -+ // (which also includes pParent) -+ if( pChild->GetDictionary().GetKeyAsName( PdfName( "Type" ) ) -+ == PdfName( "Page" ) ) -+ { -+ PdfObject* node=pParent; -+ while (node) -+ { -+ pdf_int64 count=0; -+ if (node->GetIndirectKey("Count")) count=node->GetIndirectKey("Count")->GetNumber(); -+ count++; -+ node->GetDictionary().AddKey( PdfName("Count"), count); -+ -+ node=node->GetIndirectKey("Parent"); -+ } -+ } -+ -+ // 3. Add Parent key to the child -+ pChild->GetDictionary().AddKey( PdfName("Parent"), pParent->Reference()); -+} -diff -rupN podofo-0.9.6/test/unit/PagesTreeTest.h podofo-0.9.6-new/test/unit/PagesTreeTest.h ---- podofo-0.9.6/test/unit/PagesTreeTest.h 2009-05-08 19:45:52.000000000 +0200 -+++ podofo-0.9.6-new/test/unit/PagesTreeTest.h 2019-03-13 23:15:12.174138740 +0100 -@@ -21,11 +21,14 @@ - #ifndef _PAGES_TREE_TEST_H_ - #define _PAGES_TREE_TEST_H_ - -+#include -+ - #include - - namespace PoDoFo { - class PdfMemDocument; - class PdfPage; -+class PdfObject; - }; - - /** This test tests the class PdfPagesTree -@@ -35,6 +38,9 @@ class PagesTreeTest : public CppUnit::Te - CPPUNIT_TEST_SUITE( PagesTreeTest ); - CPPUNIT_TEST( testEmptyTree ); - CPPUNIT_TEST( testEmptyDoc ); -+ CPPUNIT_TEST( testCyclicTree ); -+ CPPUNIT_TEST( testEmptyKidsTree ); -+ CPPUNIT_TEST( testNestedArrayTree ); - CPPUNIT_TEST( testCreateDelete ); - CPPUNIT_TEST( testGetPagesCustom ); - CPPUNIT_TEST( testGetPagesPoDoFo ); -@@ -52,6 +58,9 @@ class PagesTreeTest : public CppUnit::Te - - void testEmptyTree(); - void testEmptyDoc(); -+ void testCyclicTree(); -+ void testEmptyKidsTree(); -+ void testNestedArrayTree(); - void testCreateDelete(); - void testGetPagesCustom(); - void testGetPagesPoDoFo(); -@@ -98,7 +107,58 @@ class PagesTreeTest : public CppUnit::Te - */ - void CreateTestTreeCustom( PoDoFo::PdfMemDocument & rDoc ); - -+ /** -+ * Create a pages tree with cycles to test prevention of endless -+ * recursion as mentioned in different CVE reports. -+ * -+ * \param bCreateCycle if true a cyclic tree is created, otherwise a -+ * valid tree without cycles -+ */ -+ void CreateCyclicTree( PoDoFo::PdfMemDocument & rDoc, -+ bool bCreateCycle ); -+ -+ /** -+ * Create a pages tree with nodes containing empty kids. -+ * -+ * This is completely valid according to the PDF spec, i.e. the -+ * required keys may have the values "/Kids [ ]" and "/Count 0" -+ * Such a tree must still be parsable by a conforming reader: -+ * -+ *
The tree contains nodes of two types���intermediate -+ * nodes, called page tree nodes, and leaf nodes, called page -+ * objects���whose form is described in the subsequent subclauses. -+ * Conforming products shall be prepared to handle any form -+ * of tree structure built of such nodes.
-+ */ -+ void CreateEmptyKidsTree( PoDoFo::PdfMemDocument & rDoc ); -+ -+ /** -+ * Ceate a pages tree with a nested kids array. -+ * -+ * Such a tree is not valid to the PDF spec, which requires they key -+ * "Kids" to be an array of indirect references. And the children shall -+ * only be page objects or other page tree nodes. -+ */ -+ void CreateNestedArrayTree( PoDoFo::PdfMemDocument & rDoc ); -+ -+ /** -+ * Create page object nodes (leaf nodes), -+ * where every page object has an additional -+ * key PoDoFoTestPageNumber with the original -+ * page number of the page. -+ */ -+ std::vector CreateSamplePages( PoDoFo::PdfMemDocument & rDoc, -+ int nPageCount); -+ -+ /** -+ * Create page tree nodes (internal nodes) -+ */ -+ std::vector CreateNodes( PoDoFo::PdfMemDocument & rDoc, -+ int nNodeCount); -+ - bool IsPageNumber( PoDoFo::PdfPage* pPage, int nNumber ); -+ -+ void AppendChildNode(PoDoFo::PdfObject* pParent, PoDoFo::PdfObject* pChild); - }; - - #endif // _PAGES_TREE_TEST_H_ diff --git a/podofo_CVE-2018-11255.patch b/podofo_CVE-2018-11255.patch deleted file mode 100644 index 4df6679..0000000 --- a/podofo_CVE-2018-11255.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -rupN podofo-0.9.6/src/doc/PdfPage.cpp podofo-0.9.6-new/src/doc/PdfPage.cpp ---- podofo-0.9.6/src/doc/PdfPage.cpp 2018-03-11 20:40:59.000000000 +0100 -+++ podofo-0.9.6-new/src/doc/PdfPage.cpp 2019-03-13 23:15:12.206138732 +0100 -@@ -595,6 +595,13 @@ unsigned int PdfPage::GetPageNumber() co - while( it != kids.end() && (*it).GetReference() != ref ) - { - PdfObject* pNode = this->GetObject()->GetOwner()->GetObject( (*it).GetReference() ); -+ if (!pNode) -+ { -+ std::ostringstream oss; -+ oss << "Object " << (*it).GetReference().ToString() << " not found from Kids array " -+ << pKids->Reference().ToString(); -+ PODOFO_RAISE_ERROR_INFO( ePdfError_NoObject, oss.str() ); -+ } - - if( pNode->GetDictionary().GetKey( PdfName::KeyType ) != NULL - && pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) ) diff --git a/podofo_CVE-2018-11256.patch b/podofo_CVE-2018-11256.patch deleted file mode 100644 index 50bf8ad..0000000 --- a/podofo_CVE-2018-11256.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -rupN podofo-0.9.6/src/doc/PdfDocument.cpp podofo-0.9.6-new/src/doc/PdfDocument.cpp ---- podofo-0.9.6/src/doc/PdfDocument.cpp 2016-11-18 20:08:56.000000000 +0100 -+++ podofo-0.9.6-new/src/doc/PdfDocument.cpp 2019-03-13 23:15:12.234138725 +0100 -@@ -325,6 +325,12 @@ const PdfDocument & PdfDocument::Append( - for(int i=0;iGetObject()->Reference().ObjectNumber() + difference, pPage->GetObject()->Reference().GenerationNumber() ) ); - if( pObj->IsDictionary() && pObj->GetDictionary().HasKey( "Parent" ) ) - pObj->GetDictionary().RemoveKey( "Parent" ); diff --git a/podofo_CVE-2018-12982.patch b/podofo_CVE-2018-12982.patch deleted file mode 100644 index 604c4eb..0000000 --- a/podofo_CVE-2018-12982.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff -rupN podofo-0.9.6/src/base/PdfDictionary.h podofo-0.9.6-new/src/base/PdfDictionary.h ---- podofo-0.9.6/src/base/PdfDictionary.h 2018-06-11 01:46:56.000000000 +0200 -+++ podofo-0.9.6-new/src/base/PdfDictionary.h 2019-03-13 23:15:12.260138718 +0100 -@@ -180,6 +180,21 @@ class PODOFO_API PdfDictionary : public - */ - PdfObject* GetKey( const PdfName & key ); - -+ /** Get the key's value out of the dictionary. -+ * -+ * The returned value is a reference to the internal object in the dictionary -+ * so it MUST not be deleted. If the key is not found, this throws a PdfError -+ * exception with error code ePdfError_NoObject, instead of returning. -+ * This is intended to make code more readable by sparing (especially multiple) -+ * NULL checks. -+ * -+ * \param key look for the key named key in the dictionary -+ * -+ * \returns reference to the found value (never 0). -+ * \throws PdfError(ePdfError_NoObject). -+ */ -+ inline const PdfObject& MustGetKey( const PdfName & key ) const; -+ - pdf_int64 GetKeyAsLong( const PdfName & key, pdf_int64 lDefault = 0 ) const; - - double GetKeyAsReal( const PdfName & key, double dDefault = 0.0 ) const; -@@ -305,6 +320,18 @@ TKeyMap & PdfDictionary::GetKeys() - // ----------------------------------------------------- - // - // ----------------------------------------------------- -+ -+const PdfObject& PdfDictionary::MustGetKey( const PdfName & key ) const -+{ -+ const PdfObject* obj = GetKey( key ); -+ if (!obj) -+ PODOFO_RAISE_ERROR( ePdfError_NoObject ); -+ return *obj; -+} -+ -+// ----------------------------------------------------- -+// -+// ----------------------------------------------------- - void PdfDictionary::Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt* pEncrypt ) const - { - this->Write( pDevice, eWriteMode, pEncrypt, PdfName::KeyNull ); -diff -rupN podofo-0.9.6/src/base/PdfEncrypt.cpp podofo-0.9.6-new/src/base/PdfEncrypt.cpp ---- podofo-0.9.6/src/base/PdfEncrypt.cpp 2017-02-26 21:48:19.000000000 +0100 -+++ podofo-0.9.6-new/src/base/PdfEncrypt.cpp 2019-03-13 23:15:12.260138718 +0100 -@@ -561,13 +561,13 @@ PdfEncrypt* PdfEncrypt::CreatePdfEncrypt - try { - PdfString sTmp; - -- lV = static_cast(pObject->GetDictionary().GetKey( PdfName("V") )->GetNumber()); -- rValue = static_cast(pObject->GetDictionary().GetKey( PdfName("R") )->GetNumber()); -+ lV = static_cast(pObject->GetDictionary().MustGetKey( PdfName("V") ).GetNumber()); -+ rValue = static_cast( pObject->GetDictionary().MustGetKey( PdfName("R") ).GetNumber()); - -- pValue = static_cast(pObject->GetDictionary().GetKey( PdfName("P") )->GetNumber()); -+ pValue = static_cast( pObject->GetDictionary().MustGetKey( PdfName("P") ).GetNumber()); - -- oValue = pObject->GetDictionary().GetKey( PdfName("O") )->GetString(); -- uValue = pObject->GetDictionary().GetKey( PdfName("U") )->GetString(); -+ oValue = pObject->GetDictionary().MustGetKey( PdfName("O") ).GetString(); -+ uValue = pObject->GetDictionary().MustGetKey( PdfName("U") ).GetString(); - - if( pObject->GetDictionary().HasKey( PdfName("Length") ) ) - { -@@ -593,7 +593,7 @@ PdfEncrypt* PdfEncrypt::CreatePdfEncrypt - } - } - } catch( PdfError & e ) { -- e.AddToCallstack( __FILE__, __LINE__, "Invalid key in encryption dictionary" ); -+ e.AddToCallstack( __FILE__, __LINE__, "Invalid or missing key in encryption dictionary" ); - throw e; - } - diff --git a/podofo_CVE-2018-12983.diff b/podofo_CVE-2018-12983.patch similarity index 66% rename from podofo_CVE-2018-12983.diff rename to podofo_CVE-2018-12983.patch index 7bfa3e5..be047f6 100644 --- a/podofo_CVE-2018-12983.diff +++ b/podofo_CVE-2018-12983.patch @@ -1,7 +1,7 @@ -diff -rupN --no-dereference podofo-0.9.6/src/base/PdfEncrypt.cpp podofo-0.9.6-new/src/base/PdfEncrypt.cpp ---- podofo-0.9.6/src/base/PdfEncrypt.cpp 2020-07-02 10:27:57.484446311 +0200 -+++ podofo-0.9.6-new/src/base/PdfEncrypt.cpp 2020-07-02 10:27:57.694448247 +0200 -@@ -607,6 +607,12 @@ PdfEncrypt* PdfEncrypt::CreatePdfEncrypt +diff -rupN --no-dereference podofo-0.9.7/src/podofo/base/PdfEncrypt.cpp podofo-0.9.7-new/src/podofo/base/PdfEncrypt.cpp +--- podofo-0.9.7/src/podofo/base/PdfEncrypt.cpp 2019-01-15 14:04:40.000000000 +0100 ++++ podofo-0.9.7-new/src/podofo/base/PdfEncrypt.cpp 2021-01-09 20:24:45.328924249 +0100 +@@ -615,6 +615,12 @@ PdfEncrypt* PdfEncrypt::CreatePdfEncrypt && PdfEncrypt::IsEncryptionEnabled( ePdfEncryptAlgorithm_RC4V2 ) ) { // [Alexey] - lLength is pdf_int64. Please make changes in encryption algorithms diff --git a/podofo_CVE-2018-14320.patch b/podofo_CVE-2018-14320.patch deleted file mode 100644 index b892418..0000000 --- a/podofo_CVE-2018-14320.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff -rupN podofo-0.9.6/src/base/PdfEncoding.cpp podofo-0.9.6-new/src/base/PdfEncoding.cpp ---- podofo-0.9.6/src/base/PdfEncoding.cpp 2017-04-28 18:49:01.000000000 +0200 -+++ podofo-0.9.6-new/src/base/PdfEncoding.cpp 2019-03-13 23:15:12.294138709 +0100 -@@ -285,6 +285,12 @@ void PdfEncoding::ParseToUnicode() - - if (strcmp (streamToken, "beginbfrange") == 0) - { -+ // need 2 entries - one to pop() and one for top() -+ if ( stkToken.size() < 2 ) -+ { -+ PODOFO_RAISE_ERROR_INFO(ePdfError_InvalidStream, "CMap missing object number before beginbfrange"); -+ } -+ - i = loop = 0; - in_beginbfrange = 1; - stkToken.pop (); -@@ -301,6 +307,12 @@ void PdfEncoding::ParseToUnicode() - - if (strcmp (streamToken, "beginbfchar") == 0) - { -+ // need 2 entries - one to pop() and one for top() -+ if ( stkToken.size() < 2 ) -+ { -+ PODOFO_RAISE_ERROR_INFO(ePdfError_InvalidStream, "CMap missing object number before beginbfchar"); -+ } -+ - i = loop = 0; - in_beginbfchar = 1; - stkToken.pop (); -diff -rupN podofo-0.9.6/test/unit/EncodingTest.cpp podofo-0.9.6-new/test/unit/EncodingTest.cpp ---- podofo-0.9.6/test/unit/EncodingTest.cpp 2018-03-10 18:01:08.000000000 +0100 -+++ podofo-0.9.6-new/test/unit/EncodingTest.cpp 2019-03-13 23:15:12.294138709 +0100 -@@ -359,6 +359,57 @@ void EncodingTest::testToUnicodeParse() - #endif - CPPUNIT_ASSERT_EQUAL( expects, unicodeStr[ii] ); - } -+ -+ const char* toUnicodeInvalidTests[] = -+ { -+ // missing object numbers -+ "beginbfrange\n", -+ "beginbfchar\n", -+ -+ // invalid hex digits -+ "2 beginbfrange endbfrange\n", -+ "2 beginbfrange <-123> endbfrange\n", -+ "2 beginbfrange <<00>> endbfrange\n", -+ -+ // missing hex digits -+ "2 beginbfrange <> endbfrange\n", -+ -+ // empty array -+ "2 beginbfrange [] endbfrange\n", -+ -+ nullptr -+ }; -+ -+ for ( size_t i = 0 ; toUnicodeInvalidTests[i] != nullptr ; ++i ) -+ { -+ try -+ { -+ PdfVecObjects vecInvalid; -+ PdfObject *strmInvalidObject; -+ -+ vec.SetAutoDelete( true ); -+ -+ strmInvalidObject = vecInvalid.CreateObject( PdfVariant( PdfDictionary() ) ); -+ strmInvalidObject->GetStream()->Set( toUnicodeInvalidTests[i], strlen( toUnicodeInvalidTests[i] ) ); -+ -+ PdfIdentityEncoding encodingTestInvalid(0x0001, 0x000F, true, strmInvalidObject); -+ -+ PdfString unicodeStringTestInvalid = encoding.ConvertToUnicode( PdfString( encodedStr ), NULL ); -+ -+ // exception not thrown - should never get here -+ // TODO not all invalid input throws an exception (e.g. no hex digits in ) -+ //CPPUNIT_ASSERT( false ); -+ } -+ catch ( PoDoFo::PdfError& error ) -+ { -+ // parsing every invalid test string should throw an exception -+ CPPUNIT_ASSERT( true ); -+ } -+ catch( std::exception& ex ) -+ { -+ CPPUNIT_FAIL( "Unexpected exception type" ); -+ } -+ } - } - - bool EncodingTest::outofRangeHelper( PdfEncoding* pEncoding, std::string & rMsg, const char* pszName ) diff --git a/podofo_CVE-2018-19532.patch b/podofo_CVE-2018-19532.patch deleted file mode 100644 index ecb8634..0000000 --- a/podofo_CVE-2018-19532.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -rupN podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp ---- podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp 2016-11-18 20:08:56.000000000 +0100 -+++ podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp 2019-03-13 23:15:12.323138702 +0100 -@@ -256,7 +256,13 @@ namespace PoDoFo - PdfPage * page = sourceDoc->GetPage ( i ); - PdfMemoryOutputStream outMemStream ( 1 ); - -- PdfXObject *xobj = new PdfXObject ( page->GetMediaBox(), targetDoc ); -+ if (!page) // Fix issue #32 -+ { -+ std::ostringstream oss; -+ oss << "Page " << i << " (0-based) of " << pcount << " in source doc not found!"; -+ PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, oss.str() ); -+ } -+ PdfXObject *xobj = new PdfXObject ( page->GetMediaBox(), targetDoc ); - if ( page->GetContents()->HasStream() ) - { - page->GetContents()->GetStream()->GetFilteredCopy ( &outMemStream ); diff --git a/podofo_CVE-2018-20751.patch b/podofo_CVE-2018-20751.patch deleted file mode 100644 index 2ccc728..0000000 --- a/podofo_CVE-2018-20751.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -rupN podofo-0.9.6/tools/podofocrop/podofocrop.cpp podofo-0.9.6-new/tools/podofocrop/podofocrop.cpp ---- podofo-0.9.6/tools/podofocrop/podofocrop.cpp 2016-11-18 20:08:56.000000000 +0100 -+++ podofo-0.9.6-new/tools/podofocrop/podofocrop.cpp 2019-03-13 23:15:12.352138694 +0100 -@@ -61,6 +61,11 @@ void crop_page( PdfPage* pPage, const Pd - rCropBox.GetHeight()); - */ - rCropBox.ToVariant( var ); -+ if (!pPage) -+ { -+ PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidHandle, -+ "crop_page: No page pointer given" ); -+ } - pPage->GetObject()->GetDictionary().AddKey( PdfName("MediaBox"), var ); - } - diff --git a/podofo_CVE-2018-5783.patch b/podofo_CVE-2018-5783.patch deleted file mode 100644 index 3b68977..0000000 --- a/podofo_CVE-2018-5783.patch +++ /dev/null @@ -1,106 +0,0 @@ -diff -rupN podofo-0.9.6/src/base/PdfCompilerCompat.h podofo-0.9.6-new/src/base/PdfCompilerCompat.h ---- podofo-0.9.6/src/base/PdfCompilerCompat.h 2017-10-27 08:38:19.000000000 +0200 -+++ podofo-0.9.6-new/src/base/PdfCompilerCompat.h 2019-03-13 23:15:12.143138748 +0100 -@@ -184,12 +184,15 @@ namespace PoDoFo { - #if defined(_MSC_VER) - # define PDF_FORMAT_INT64 "I64d" - # define PDF_FORMAT_UINT64 "I64u" -+# define PDF_SIZE_FORMAT "Iu" - #elif defined(SZ_INT64) && defined(SZ_LONG) && SZ_INT64 == SZ_LONG - # define PDF_FORMAT_INT64 "ld" - # define PDF_FORMAT_UINT64 "lu" -+# define PDF_SIZE_FORMAT "zu" - #else - # define PDF_FORMAT_INT64 "lld" - # define PDF_FORMAT_UINT64 "llu" -+# define PDF_SIZE_FORMAT "zu" - #endif - - -diff -rupN podofo-0.9.6/src/base/PdfVecObjects.cpp podofo-0.9.6-new/src/base/PdfVecObjects.cpp ---- podofo-0.9.6/src/base/PdfVecObjects.cpp 2017-06-04 15:28:32.000000000 +0200 -+++ podofo-0.9.6-new/src/base/PdfVecObjects.cpp 2019-03-13 23:15:12.144138748 +0100 -@@ -100,6 +100,10 @@ private: - const PdfReference m_ref; - }; - -+// This is static, IMHO (mabri) different values per-instance could cause confusion. -+// It has to be defined here because of the one-definition rule. -+size_t PdfVecObjects::m_nMaxReserveSize = static_cast(8388607); // cf. Table C.1 in section C.2 of PDF32000_2008.pdf -+ - PdfVecObjects::PdfVecObjects() - : m_bAutoDelete( false ), m_bCanReuseObjectNumbers( true ), m_nObjectCount( 1 ), m_bSorted( true ), m_pDocument( NULL ), m_pStreamFactory( NULL ) - { -diff -rupN podofo-0.9.6/src/base/PdfVecObjects.h podofo-0.9.6-new/src/base/PdfVecObjects.h ---- podofo-0.9.6/src/base/PdfVecObjects.h 2016-11-14 17:21:06.000000000 +0100 -+++ podofo-0.9.6-new/src/base/PdfVecObjects.h 2019-03-13 23:15:12.144138748 +0100 -@@ -414,6 +414,25 @@ class PODOFO_API PdfVecObjects { - inline PdfObject* GetBack(); - - /** -+ * Set the maximum number of elements Reserve() will work for (to fix -+ * CVE-2018-5783) which is called with a value from the PDF in the parser. -+ * The default is from Table C.1 in section C.2 of PDF32000_2008.pdf -+ * (PDF 1.7 standard free version). -+ * This sets a static variable, so don't use from multiple threads -+ * (without proper locking). -+ * \param size Number of elements to allow to be reserved -+ */ -+ void SetMaxReserveSize(size_t size); -+ -+ /** -+ * Gets the maximum number of elements Reserve() will work for (to fix -+ * CVE-2018-5783) which is called with a value from the PDF in the parser. -+ * The default is from Table C.1 in section C.2 of PDF32000_2008.pdf -+ * (PDF 1.7 standard free version): 8388607. -+ */ -+ size_t GetMaxReserveSize() const; -+ -+ /** - * Deletes all objects that are not references by other objects - * besides the trailer (which references the root dictionary, which in - * turn should reference all other objects). -@@ -480,6 +499,7 @@ class PODOFO_API PdfVecObjects { - StreamFactory* m_pStreamFactory; - - std::string m_sSubsetPrefix; ///< Prefix for BaseFont and FontName of subsetted font -+ static size_t m_nMaxReserveSize; - }; - - -@@ -494,9 +514,34 @@ inline size_t PdfVecObjects::GetSize() c - // ----------------------------------------------------- - // - // ----------------------------------------------------- -+inline void PdfVecObjects::SetMaxReserveSize(size_t size) -+{ -+ m_nMaxReserveSize = size; -+} -+ -+// ----------------------------------------------------- -+// -+// ----------------------------------------------------- -+inline size_t PdfVecObjects::GetMaxReserveSize() const -+{ -+ return m_nMaxReserveSize; -+} -+ -+// ----------------------------------------------------- -+// -+// ----------------------------------------------------- - inline void PdfVecObjects::Reserve( size_t size ) - { -- m_vector.reserve( size ); -+ if( size <= m_nMaxReserveSize ) // Fix CVE-2018-5783 -+ { -+ m_vector.reserve( size ); -+ } -+ else -+ { -+ PdfError::DebugMessage( "Call to PdfVecObjects::Reserve with %" -+ PDF_SIZE_FORMAT" is over allowed limit of %" -+ PDF_SIZE_FORMAT".\n", size, m_nMaxReserveSize ); -+ } - } - - // ----------------------------------------------------- diff --git a/podofo_CVE-2019-20093.patch b/podofo_CVE-2019-20093.patch index 3529000..df52149 100644 --- a/podofo_CVE-2019-20093.patch +++ b/podofo_CVE-2019-20093.patch @@ -1,6 +1,6 @@ -diff -wrupN podofo-0.9.6/tools/podofoimgextract/ImageExtractor.cpp podofo-0.9.6-new/tools/podofoimgextract/ImageExtractor.cpp ---- podofo-0.9.6/tools/podofoimgextract/ImageExtractor.cpp 2018-02-25 12:48:38.000000000 +0100 -+++ podofo-0.9.6-new/tools/podofoimgextract/ImageExtractor.cpp 2020-01-17 19:43:48.619699851 +0100 +diff -rupN --no-dereference podofo-0.9.7/tools/podofoimgextract/ImageExtractor.cpp podofo-0.9.7-new/tools/podofoimgextract/ImageExtractor.cpp +--- podofo-0.9.7/tools/podofoimgextract/ImageExtractor.cpp 2018-02-25 12:48:38.000000000 +0100 ++++ podofo-0.9.7-new/tools/podofoimgextract/ImageExtractor.cpp 2021-01-09 20:24:45.300929872 +0100 @@ -117,6 +117,11 @@ void ImageExtractor::ExtractImage( PdfOb //long lBitsPerComponent = pObject->GetDictionary().GetKey( PdfName("BitsPerComponent" ) )->GetNumber(); // TODO: Handle colorspaces diff --git a/podofo_CVE-2019-9199.patch b/podofo_CVE-2019-9199.patch deleted file mode 100644 index 8dd8c10..0000000 --- a/podofo_CVE-2019-9199.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -rupN podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp ---- podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp 2019-03-13 23:15:12.348138695 +0100 -+++ podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp 2019-03-13 23:15:12.381138687 +0100 -@@ -148,7 +148,12 @@ namespace PoDoFo - // std::cerr << "Document has "<< pcount << " page(s) " << endl; - if ( pcount > 0 ) // only here to avoid possible segfault, but PDF without page is not conform IIRC - { -- PoDoFo::PdfRect rect ( sourceDoc->GetPage ( 0 )->GetMediaBox() ); -+ PoDoFo::PdfPage* pFirstPage = sourceDoc->GetPage ( 0 ); -+ if ( NULL == pFirstPage ) // Fixes CVE-2019-9199 (issue #40) -+ { -+ PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, "First page (0) of source document not found" ); -+ } -+ PoDoFo::PdfRect rect ( pFirstPage->GetMediaBox() ); - // keep in mind it’s just a hint since PDF can have different page sizes in a same doc - sourceWidth = rect.GetWidth() - rect.GetLeft(); - sourceHeight = rect.GetHeight() - rect.GetBottom() ; diff --git a/podofo_CVE-2019-9687.patch b/podofo_CVE-2019-9687.patch deleted file mode 100644 index e4df8b4..0000000 --- a/podofo_CVE-2019-9687.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff -rupN podofo-0.9.6/src/base/PdfString.cpp podofo-0.9.6-new/src/base/PdfString.cpp ---- podofo-0.9.6/src/base/PdfString.cpp 2018-03-10 17:30:53.000000000 +0100 -+++ podofo-0.9.6-new/src/base/PdfString.cpp 2019-03-13 23:15:12.410138679 +0100 -@@ -626,8 +626,19 @@ void PdfString::InitUtf8() - pdf_long lUtf8 = PdfString::ConvertUTF16toUTF8( reinterpret_cast(m_buffer.GetBuffer()), - this->GetUnicodeLength(), - reinterpret_cast(pBuffer), lBufferLen, ePdfStringConversion_Lenient ); -+ if (lUtf8 + 1 > lBufferLen) // + 1 to account for 2 bytes termination here vs. 1 byte there -+ { -+ pBuffer = static_cast(podofo_realloc( pBuffer, lUtf8 + 1 ) ); -+ if( !pBuffer ) -+ { -+ PODOFO_RAISE_ERROR( ePdfError_OutOfMemory ); -+ } -+ if (lUtf8 - 1 > lBufferLen) -+ lUtf8 = PdfString::ConvertUTF16toUTF8( reinterpret_cast(m_buffer.GetBuffer()), -+ this->GetUnicodeLength(), reinterpret_cast(pBuffer), lUtf8 + 1); -+ } - -- pBuffer[lUtf8-1] = '\0'; -+ pBuffer[lUtf8 - 1] = '\0'; - pBuffer[lUtf8] = '\0'; - m_sUtf8 = pBuffer; - podofo_free( pBuffer ); -@@ -811,6 +822,7 @@ pdf_long PdfString::ConvertUTF16toUTF8( - return ConvertUTF16toUTF8( pszUtf16, lLen, pszUtf8, lLenUtf8 ); - } - -+// returns used, or if not enough memory passed in, needed length incl. 1 byte termination - pdf_long PdfString::ConvertUTF16toUTF8( const pdf_utf16be* pszUtf16, pdf_long lLenUtf16, - pdf_utf8* pszUtf8, pdf_long lLenUtf8, - EPdfStringConversion eConversion ) -@@ -828,12 +840,21 @@ pdf_long PdfString::ConvertUTF16toUTF8( - size_t sLength = lLenUtf16; - size_t resultBufLength = lLenUtf8; - -- u16_to_u8 ( s, sLength, pResultBuf, &resultBufLength); -+ uint8_t* pReturnBuf = u16_to_u8( s, sLength, pResultBuf, &resultBufLength ); -+ if (pReturnBuf != pResultBuf) -+ { -+ free(pReturnBuf); // allocated by libunistring, so don't use podofo_free() -+ PdfError::LogMessage( eLogSeverity_Warning, "Output string size too little to hold it\n" ); -+ return resultBufLength + 1; -+ } - - pdf_long lBufferLen = PODOFO_MIN( static_cast(resultBufLength + 1), lLenUtf8 ); - -- // Make sure buffer is 0 termnated -- pszUtf8[resultBufLength] = 0; -+ // Make sure buffer is 0 terminated -+ if ( static_cast(resultBufLength + 1) <= lLenUtf8 ) -+ pszUtf8[resultBufLength] = 0; -+ else -+ return resultBufLength + 1; // means: check for this in the caller to detect non-termination - - return lBufferLen; - } diff --git a/podofo_maxbytes.patch b/podofo_maxbytes.patch index 799750a..0701249 100644 --- a/podofo_maxbytes.patch +++ b/podofo_maxbytes.patch @@ -1,6 +1,6 @@ -diff -rupN --no-dereference podofo-0.9.6/src/base/PdfParser.h podofo-0.9.6-new/src/base/PdfParser.h ---- podofo-0.9.6/src/base/PdfParser.h 2018-04-30 21:21:55.000000000 +0200 -+++ podofo-0.9.6-new/src/base/PdfParser.h 2020-07-04 10:03:14.047752638 +0200 +diff -rupN --no-dereference podofo-0.9.7/src/podofo/base/PdfParser.h podofo-0.9.7-new/src/podofo/base/PdfParser.h +--- podofo-0.9.7/src/podofo/base/PdfParser.h 2020-03-27 17:53:35.000000000 +0100 ++++ podofo-0.9.7-new/src/podofo/base/PdfParser.h 2021-01-09 20:24:45.356918625 +0100 @@ -39,7 +39,7 @@ #include "PdfVecObjects.h" @@ -10,10 +10,10 @@ diff -rupN --no-dereference podofo-0.9.6/src/base/PdfParser.h podofo-0.9.6-new/s namespace PoDoFo { -diff -rupN --no-dereference podofo-0.9.6/src/base/PdfXRefStreamParserObject.cpp podofo-0.9.6-new/src/base/PdfXRefStreamParserObject.cpp ---- podofo-0.9.6/src/base/PdfXRefStreamParserObject.cpp 2018-02-18 13:02:28.000000000 +0100 -+++ podofo-0.9.6-new/src/base/PdfXRefStreamParserObject.cpp 2020-07-04 10:03:14.047752638 +0200 -@@ -223,7 +223,7 @@ void PdfXRefStreamParserObject::ReadXRef +diff -rupN --no-dereference podofo-0.9.7/src/podofo/base/PdfXRefStreamParserObject.cpp podofo-0.9.7-new/src/podofo/base/PdfXRefStreamParserObject.cpp +--- podofo-0.9.7/src/podofo/base/PdfXRefStreamParserObject.cpp 2020-10-10 19:17:47.000000000 +0200 ++++ podofo-0.9.7-new/src/podofo/base/PdfXRefStreamParserObject.cpp 2021-01-09 20:24:45.356918625 +0100 +@@ -237,7 +237,7 @@ void PdfXRefStreamParserObject::ReadXRef { int i; pdf_int64 z; @@ -22,7 +22,7 @@ diff -rupN --no-dereference podofo-0.9.6/src/base/PdfXRefStreamParserObject.cpp for( i=0;i -Bug: https://sourceforge.net/p/podofo/tickets/30 -Bug-Debian: https://bugs.debian.org/908134 -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpodofo/+bug/1792407 -Last-Update: 2018-09-18 - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -314,10 +314,10 @@ - MESSAGE("Pkg-config found, creating a pkg-config file for linking against shared library.") - CONFIGURE_FILE( - "libpodofo.pc.in" -- "${PoDoFo_BINARY_DIR}/libpodofo-${PODOFO_VERSION_MAJOR}.pc" -+ "${PoDoFo_BINARY_DIR}/libpodofo.pc" - @ONLY) - INSTALL( -- FILES "${PoDoFo_BINARY_DIR}/libpodofo-${PODOFO_VERSION_MAJOR}.pc" -+ FILES "${PoDoFo_BINARY_DIR}/libpodofo.pc" - DESTINATION "${LIBDIRNAME}/pkgconfig") - ELSE(PKG_CONFIG_FOUND) - MESSAGE("Pkg-config not found. No pkg-config file will be created.") ---- a/src/libpodofo.pc.in -+++ b/src/libpodofo.pc.in -@@ -6,5 +6,5 @@ - Name: @CMAKE_PROJECT_NAME@ - Description: A C++ library to work with the PDF file format - Version: @PODOFO_VERSION@ --Libs: -L${libdir} -lpodofo-@PODOFO_VERSION_MAJOR@ -+Libs: -L${libdir} -lpodofo - Cflags: -I${includedir} diff --git a/podofo_tests.patch b/podofo_tests.patch deleted file mode 100644 index 3c7ef21..0000000 --- a/podofo_tests.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -rupN podofo-0.9.6/test/TokenizerTest/CMakeLists.txt podofo-0.9.6-new/test/TokenizerTest/CMakeLists.txt ---- podofo-0.9.6/test/TokenizerTest/CMakeLists.txt 2007-09-16 11:33:38.000000000 +0200 -+++ podofo-0.9.6-new/test/TokenizerTest/CMakeLists.txt 2019-03-13 23:15:12.116138755 +0100 -@@ -2,10 +2,3 @@ ADD_EXECUTABLE(TokenizerTest TokenizerTe - TARGET_LINK_LIBRARIES(TokenizerTest ${PODOFO_LIB} ${PODOFO_LIB_DEPENDS}) - SET_TARGET_PROPERTIES(TokenizerTest PROPERTIES COMPILE_FLAGS "${PODOFO_CFLAGS}") - ADD_DEPENDENCIES(TokenizerTest ${PODOFO_DEPEND_TARGET}) -- --# Copy the test samples over to the build tree --ADD_CUSTOM_COMMAND( -- TARGET TokenizerTest -- POST_BUILD -- COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/objects" "${CMAKE_CURRENT_BINARY_DIR}/objects" -- ) diff --git a/sources b/sources index b4a387d..f5da55d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (podofo-0.9.6.tar.gz) = 35c1a457758768bdadc93632385f6b9214824fead279f1b85420443fb2135837cefca9ced476df0d47066f060e9150e12fcd40f60fa1606b177da433feb20130 +SHA512 (podofo-0.9.7.tar.gz) = 0e699739c2fb7d4d02ffca371504bb19f3a8a97ddcbfc06f8d9636db9e73064b4f633f7f09bce92140bb2174610ad68c1e5f8460d474d176ab803ed28295251b