File podofo-CVE-2018-12983.patch of Package podofo.35912

diff -urp podofo-0.9.2.orig/src/base/PdfEncrypt.cpp podofo-0.9.2/src/base/PdfEncrypt.cpp
--- podofo-0.9.2.orig/src/base/PdfEncrypt.cpp	2022-09-06 16:33:36.148401581 -0500
+++ podofo-0.9.2/src/base/PdfEncrypt.cpp	2022-09-15 14:30:24.729580734 -0500
@@ -443,6 +443,12 @@ PdfEncrypt* PdfEncrypt::CreatePdfEncrypt
             && PdfEncrypt::IsEncryptionEnabled( ePdfEncryptAlgorithm_RC4V2 ) ) 
     {
         // [Alexey] - lLength is long long. Please make changes in encryption algorithms
+        // [mabri] - Fix CVE-2018-12983: Check key length lLength here
+        // to prevent stack-based buffer over-read in line 867 of this file
+        if (lLength > MD5_DIGEST_LENGTH * 8) // lLength in bits, md5 in bytes 
+        {
+            PODOFO_RAISE_ERROR_INFO( ePdfError_ValueOutOfRange, "Given key length too large for MD5." );
+        }
         pdfEncrypt = new PdfEncryptRC4(oValue, uValue, pValue, rValue, ePdfEncryptAlgorithm_RC4V2, static_cast<int>(lLength));
     }
     else if( (lV == 4L) && (rValue == 4L)
openSUSE Build Service is sponsored by