File podofo-CVE-2018-12983.patch of Package podofo (Revision 6e504dca4c02689f5b02fe44cf43c425)
Currently displaying revision 6e504dca4c02689f5b02fe44cf43c425 , Show latest
18
1
Index: src/base/PdfEncrypt.cpp
2
===================================================================
3
--- src/base/PdfEncrypt.cpp (revision 1929)
4
+++ src/base/PdfEncrypt.cpp (working copy)
5
6
&& PdfEncrypt::IsEncryptionEnabled( ePdfEncryptAlgorithm_RC4V2 ) )
7
{
8
// [Alexey] - lLength is pdf_int64. Please make changes in encryption algorithms
9
+ // [mabri] - Fix CVE-2018-12983: Check key length lLength here
10
+ // to prevent stack-based buffer over-read in line 867 of this file
11
+ if (lLength > MD5_DIGEST_LENGTH * 8) // lLength in bits, md5 in bytes
12
+ {
13
+ PODOFO_RAISE_ERROR_INFO( ePdfError_ValueOutOfRange, "Given key length too large for MD5." );
14
+ }
15
pdfEncrypt = new PdfEncryptRC4(oValue, uValue, pValue, rValue, ePdfEncryptAlgorithm_RC4V2, static_cast<int>(lLength), encryptMetadata);
16
}
17
else
18