File r1835-Fix-for-CVE-2017-5852.patch of Package podofo.23799
------------------------------------------------------------------------
r1835 | aja_ | 2017-04-07 19:22:53 +0200 (vie, 07 abr 2017) | 2 lines
Fix for CVE-2017-5852 with added error code
Index: src/base/PdfError.cpp
===================================================================
--- src/base/PdfError.cpp (revision 1834)
+++ src/base/PdfError.cpp (revision 1835)
@@ -222,6 +222,9 @@
case ePdfError_InvalidEnumValue:
pszMsg = "ePdfError_InvalidEnumValue";
break;
+ case ePdfError_BrokenFile:
+ pszMsg = "ePdfError_BrokenFile";
+ break;
case ePdfError_PageNotFound:
pszMsg = "ePdfError_PageNotFound";
break;
@@ -397,6 +400,9 @@
case ePdfError_InvalidEnumValue:
pszMsg = "An invalid enum value was specified.";
break;
+ case ePdfError_BrokenFile:
+ pszMsg = "The file content is broken.";
+ break;
case ePdfError_PageNotFound:
pszMsg = "The requested page could not be found in the PDF.";
break;
Index: src/base/PdfError.h
===================================================================
--- src/base/PdfError.h (revision 1834)
+++ src/base/PdfError.h (revision 1835)
#@@ -73,6 +73,7 @@
# ePdfError_ValueOutOfRange, /**< The specified memory is out of the allowed range. */
# ePdfError_InternalLogic, /**< An internal sanity check or assertion failed. */
# ePdfError_InvalidEnumValue, /**< An invalid enum value was specified. */
#+ ePdfError_BrokenFile, /**< The file content is broken. */
#
# ePdfError_PageNotFound, /**< The requested page could not be found in the PDF. */
#
@@ -110,6 +110,8 @@ enum EPdfError {
ePdfError_NotCompiled, /**< This feature was disabled during compile time. */
+ ePdfError_BrokenFile, /**< The file content is broken. */
+
ePdfError_Unknown = 0xffff /**< Unknown error */
};
Index: src/doc/PdfPage.cpp
===================================================================
--- src/doc/PdfPage.cpp (revision 1834)
+++ src/doc/PdfPage.cpp (revision 1835)
@@ -228,6 +228,14 @@
if( inObject->GetDictionary().HasKey( "Parent" ) )
{
pObj = inObject->GetIndirectKey( "Parent" );
+ if( pObj == inObject )
+ {
+ std::ostringstream oss;
+ oss << "Object " << inObject->Reference().ObjectNumber() << " "
+ << inObject->Reference().GenerationNumber() << " references itself as Parent";
+ PODOFO_RAISE_ERROR_INFO( ePdfError_BrokenFile, oss.str().c_str() );
+ }
+
if( pObj )
pObj = GetInheritedKeyFromObject( inKey, pObj );
}
------------------------------------------------------------------------