On Thu, 2017-06-29 at 14:21 +0000, Jaseem Ali K T wrote:
> However the podofo code which retrieves value from names tree assumes
> the value to be always of reference type. I have faced problem
> because of this while retrieving named destinations in a particular
> file.
Hi,
I do not have data for this, thus the attached patch is a blind try,
untested and can cause memory issues in certain cases (ideally check
for use-after-free issues, like with valgrind or similar tools).
Could you give it a try, please?
Bye,
zyx
--
http://www.litePDF.cz i...@litepdf.cz
Index: src/doc/PdfNamesTree.cpp
===================================================================
--- src/doc/PdfNamesTree.cpp (revision 1851)
+++ src/doc/PdfNamesTree.cpp (working copy)
@@ -401,8 +401,8 @@ PdfObject* PdfNamesTree::GetKeyValue( Pd
}
else
{
- const PdfArray & names = pObj->GetDictionary().GetKey("Names")->GetArray();
- PdfArray::const_iterator it = names.begin();
+ PdfArray & names = pObj->GetDictionary().GetKey("Names")->GetArray();
+ PdfArray::iterator it = names.begin();
// a names array is a set of PdfString/PdfObject pairs
// so we loop in sets of two - getting each pair
@@ -411,7 +411,10 @@ PdfObject* PdfNamesTree::GetKeyValue( Pd
if( (*it).GetString() == key )
{
++it;
- return this->GetObject()->GetOwner()->GetObject( (*it).GetReference() );
+ if( it->IsReference() )
+ return this->GetObject()->GetOwner()->GetObject( (*it).GetReference() );
+
+ return &(*it);
}
it += 2;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users