File 0026-Revert-part-of-0024.patch of Package podofo
Subject: Revert part of r1872 (Fix for CVE-2017-8054 - Detect cycles in PdfPagesTree)
Url: https://sourceforge.net/p/podofo/code/1881/
This part had been causing use-after-free in test/unit/podofo-test.
--- a/podofo/trunk/src/doc/PdfPagesTree.cpp
+++ b/podofo/trunk/src/doc/PdfPagesTree.cpp
@@ -479,17 +479,7 @@
if( rVar.IsArray() )
{
// Fixes some broken PDFs who have trees with 1 element kids arrays
- // Recursive call removed to prevent stack overflow, replaced by:
- // all the following inside this conditional, plus restart looping
- const PdfArray & rVarArray = rVar.GetArray();
- if (rVarArray.GetSize() == 0)
- {
- PdfError::LogMessage( eLogSeverity_Critical, "Trying to access"
- " first page index of empty array" );
- return NULL;
- }
- rVar = rVarArray[0];
- continue;
+ return GetPageNodeFromArray( 0, rVar.GetArray(), rLstParents );
}
else if( !rVar.IsReference() )
{