File 0011-Fix-CVE-2017-6840-Out-of-bounds-read-in-ColorChanger-GetColorFromStack.patch of Package podofo
Subject: Fix CVE-2017-6840: Out of bounds read in ColorChanger::GetColorFromStack()
Url: https://sourceforge.net/p/podofo/code/1844/
--- a/podofo/trunk/tools/podofocolor/colorchanger.cpp
+++ b/podofo/trunk/tools/podofocolor/colorchanger.cpp
@@ -181,6 +181,13 @@
int nNumArgs = pInfo->nNumArguments;
EPdfColorSpace eColorSpace;
+ if( args.size() != static_cast<size_t>( pInfo->nNumArguments ) )
+ {
+ std::ostringstream oss;
+ oss << "Expected " << pInfo->nNumArguments << " argument(s) for keyword '" << pszKeyword << "', but " << args.size() << " given instead.";
+ PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidContentStream, oss.str().c_str() );
+ }
+
switch( pInfo->eKeywordType )
{
case eKeyword_GraphicsStack_Push: