Hi

Some PDF documents found in the wild cause NULL pointer dereferences in PoDoFo, 
but load correctly in Chrome/Adobe Reader, so here are some patches to fix 
these:

PdfPage.cpp
unsigned int PdfPage::GetPageNumber() const

.494
-       const PdfArray& kids        = pParent->GetIndirectKey( "Kids" 
)->GetArray();
                
+       PdfObject* pKids = pParent->GetIndirectKey( "Kids" );
+       if ( pKids != NULL )
+       {
+               const PdfArray& kids        = pKids->GetArray();


.501
-       if( pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == 
PdfName( "Pages" ) )
+       if( pNode->GetDictionary().GetKey( PdfName::KeyType ) != NULL && 
pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( 
"Pages" ) )


.510
+       }

PdfPagesTree.cpp
PdfObject* PdfPagesTree::GetPageNode

.230
-       if( !pObj->IsArray() )
+       if( pObj == NULL || !pObj->IsArray() )

Best Regards
Mark

Mark Rogers - mark.rog...@powermapper.com
PowerMapper Software Ltd - www.powermapper.com 
Registered in Scotland No 362274 Quartermile 2 Edinburgh EH3 9GL 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to