https://bugs.documentfoundation.org/show_bug.cgi?id=143472
Kevin Suo <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|FILEOPEN: pdf fails to open |FILEOPEN: pdf fails to open |in draw |in draw (because | |sdext.pdfimport does not | |accept encryption algorithm | |version > 3 and revision > | |3) CC| |[email protected] --- Comment #7 from Kevin Suo <[email protected]> --- sdext/source/pdfimport/wrapper/wrapper.cxx:1023: xpdf_ImportFromFile(...) calls sdext/source/pdfimport/wrapper/wrapper.cxx:894 checkEncryption(...) which further checks encryption in line 913: if( pPDFFile->usesSupportedEncryptionFormat() ) and fails. PDFFile::usesSupportedEncryptionFormat() is in: https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/pdfparse/pdfentries.cxx?r=776a1b9b#1212 bool PDFFile::usesSupportedEncryptionFormat() const { return m_pData->m_bStandardHandler && m_pData->m_nAlgoVersion >= 1 && m_pData->m_nAlgoVersion <= 2 && m_pData->m_nStandardRevision >= 2 && m_pData->m_nStandardRevision <= 3; } For this PDF document: (gdb) p m_pData->m_bStandardHandler $5 = true (gdb) p m_pData->m_nAlgoVersion $6 = 4 (gdb) p m_pData->m_nStandardRevision $7 = 4 So m_nAlgoVersion is not <=2 and m_nStandardRevision is not <= 3, thus does not "usesSupportedEncryptionFormat". m_pData is of struct type PDFFileImplData in https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/pdfparse/pdfentries.cxx?r=776a1b9b#1015 It's m_nAlgoVersion, m_nStandardRevsion etc are set in PDFFileImplData* PDFFile::impl_getData() in https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/pdfparse/pdfentries.cxx?r=776a1b9b#1015. Based on comment 6 the version numbers m_nAlgoVersion (4) and m_nStandardRevision(4) seems correct. So the problem would be the newer (?) decyption algorithm are "not supported" (?) by our sdext.pdfimport. However, a quick search in poppler (i.e. the upstream lib used by libreoffice to parse the pdf into xpdfimport tokens and then further assembled into an ODF draw document), it already added support for "version 5 + revision 6 documents" in year 2016: https://cgit.freedesktop.org/poppler/poppler/commit/?id=69ffeb71a79b686d5c79d20832c4666c498098e8 So it seems the code in sdext/source/pdfimport/pdfparse/pdfentries.cxx need to be updated. Actually I see in line 1345 that it seems to accept m_nAlgoVersion >= 3: if( m_pData->m_nAlgoVersion >= 3 ) Actually the version limitation there has not been touched since the very beginning in year 2008: https://cgit.freedesktop.org/libreoffice/core/commit/sdext/source/pdfimport/pdfparse/pdfentries.cxx?id=a00669b8cb4843acaea59dedc68a4dac8e016fc7 ====== Poppler `pdfinfo` output of this file: ====== Author: Studynama.com Creator: Writer Producer: OpenOffice.org 3.1 CreationDate: Wed Aug 17 21:23:43 2011 CST ModDate: Tue Sep 29 08:11:35 2015 CST Custom Metadata: no Metadata Stream: no Tagged: no UserProperties: no Suspects: no Form: none JavaScript: no Pages: 60 Encrypted: yes (print:yes copy:yes change:no addNotes:no algorithm:AES) Page size: 612 x 792 pts (letter) Page rot: 0 File size: 325547 bytes Optimized: no PDF version: 1.6 -- You are receiving this mail because: You are the assignee for the bug.
