Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
podofo.23799
r1588-Fix-various-issues-when-Kids-array-is-mis...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File r1588-Fix-various-issues-when-Kids-array-is-missing.patch of Package podofo.23799
------------------------------------------------------------------------ r1588 | aja_ | 2014-04-01 22:05:08 +0200 (mar, 01 abr 2014) | 2 lines ADDED: Patch by Mark Rogers: Fix various issues when "Kids" array is missing Index: src/doc/PdfPage.cpp =================================================================== --- src/doc/PdfPage.cpp (revision 1587) +++ src/doc/PdfPage.cpp (revision 1588) @@ -513,22 +513,28 @@ while( pParent ) { - const PdfArray& kids = pParent->GetIndirectKey( "Kids" )->GetArray(); - PdfArray::const_iterator it = kids.begin(); - - while( it != kids.end() && (*it).GetReference() != ref ) + PdfObject* pKids = pParent->GetIndirectKey( "Kids" ); + if ( pKids != NULL ) { - PdfObject* pNode = this->GetObject()->GetOwner()->GetObject( (*it).GetReference() ); + const PdfArray& kids = pKids->GetArray(); + PdfArray::const_iterator it = kids.begin(); - if( pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) ) - nPageNumber += static_cast<int>(pNode->GetDictionary().GetKey( "Count" )->GetNumber()); - else - // if we do not have a page tree node, - // we most likely have a page object: - // so the page count is 1 - ++nPageNumber; + while( it != kids.end() && (*it).GetReference() != ref ) + { + PdfObject* pNode = this->GetObject()->GetOwner()->GetObject( (*it).GetReference() ); - ++it; + if( pNode->GetDictionary().GetKey( PdfName::KeyType ) != NULL + && pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) ) + { + nPageNumber += static_cast<int>(pNode->GetDictionary().GetKey( "Count" )->GetNumber()); + } else { + // if we do not have a page tree node, + // we most likely have a page object: + // so the page count is 1 + ++nPageNumber; + } + ++it; + } } ref = pParent->Reference(); Index: src/doc/PdfPagesTree.cpp =================================================================== --- src/doc/PdfPagesTree.cpp (revision 1587) +++ src/doc/PdfPagesTree.cpp (revision 1588) @@ -303,7 +303,7 @@ const PdfObject* pObj = pParent->GetIndirectKey( "Kids" ); - if( !pObj->IsArray() ) + if( pObj == NULL || !pObj->IsArray() ) { PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); } ------------------------------------------------------------------------
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor