Hello, trying to parse a password protected (for edit and printing) pdf, I was getting an internal logic error with the following stack trace:
Error Description: ePdfError_InternalLogic
Callstack:
#0 Error Source: d:\staging\euronovate\podofo\src\base\pdfparser.cpp:273
Information: Unable to load objects from file.
#1 Error Source:
d:\staging\euronovate\podofo\src\base\pdfparserobject.cpp:403
Information: Unable to parse the stream for object 2 0 obj .
#2 Error Source:
d:\staging\euronovate\podofo\src\base\pdfencrypt.cpp:416
Information: Error AES-decryption data
I added some SSL diagnostic, revealing the following internal error:
error:060A70A2:digital envelope routines:EVP_EncryptUpdate:partially
overlapping buffers
Looking at the code in PdfEncrypt.cpp, if the comment mentioning "//
Quote openssl.org: "the decrypted..." (line 402) is still actual, I
didn't find any particular error in the current code. Still the
specific OpenSSL version I am using, which is quite recent (just 2
versions behind the latest stable version in 1.1.0 series, which is
1.1.0i) may be more fussy in verifying overlapping buffers and it may
(just a guess) always consider the worst case for space allocation. My
fix was to add an instance temporary buffer and always use that. I
recommend reviewing the patch and consider it for merging since it
seems to me safer at the cost of small optimization that, IMO, it
could have been done in a better way (the current code relies in
temporary buffer creation at occurrence anyway).
Attached a test.pdf that shows the problem and the proposed patch.
test.pdf
Description: Adobe PDF document
Fix_PdfAESStream_Openssl1.1.0g.diff
Description: Binary data
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
