diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 3ec950e22b75..67ad3af2cb96 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -1339,7 +1339,15 @@ PDFFileImplData* PDFFile::impl_getData() const { PDFNumber* pNum = dynamic_cast(len->second); if( pNum ) - m_pData->m_nKeyLength = static_cast(pNum->m_fValue) / 8; + { + sal_uInt32 nKeyLength = static_cast(pNum->m_fValue) / 8; + if (nKeyLength > ENCRYPTION_KEY_LEN) + { + SAL_WARN("sdext.pdfimport.pdfparse", "entry has length " << nKeyLength << " which is greater than " << ENCRYPTION_KEY_LEN); + nKeyLength = ENCRYPTION_KEY_LEN; + } + m_pData->m_nKeyLength = nKeyLength; + } } PDFName* pFilter = dynamic_cast(filter->second); if( pFilter && pFilter->getFilteredName() == "Standard" )