File r1833-Fix-a-crash-when-passing-a-PDF-file-.patch of Package podofo.23799

------------------------------------------------------------------------
r1833 | aja_ | 2017-03-24 19:59:20 +0100 (vie, 24 mar 2017) | 2 lines

Fix a crash when passing a PDF file with an encryption dictionary reference to a nonexistent object


Index: src/base/PdfParser.cpp
===================================================================
--- src/base/PdfParser.cpp	(revision 1832)
+++ src/base/PdfParser.cpp	(revision 1833)
@@ -948,6 +948,14 @@
         if( pEncrypt->IsReference() ) 
         {
             i = pEncrypt->GetReference().ObjectNumber();
+            if( i <= 0 || static_cast<size_t>( i ) >= m_offsets.size () )
+            {
+                std::ostringstream oss;
+                oss << "Encryption dictionary references a nonexistent object " << pEncrypt->GetReference().ObjectNumber() << " " 
+                    << pEncrypt->GetReference().GenerationNumber();
+                PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidEncryptionDict, oss.str().c_str() );
+            }
+
             pObject = new PdfParserObject( m_vecObjects, m_device, m_buffer, m_offsets[i].lOffset );
             if( !pObject )
                 PODOFO_RAISE_ERROR( ePdfError_OutOfMemory );

------------------------------------------------------------------------
openSUSE Build Service is sponsored by