On Sun, Apr 24, 2016, 15:57 UTC, I (mabri) wrote:

> Associating a string with a destination and writing it into a document

> (of at least version PDF 1.2) is done by the (abstract base class) method
> PdfDocument::AddNamedDestination(const PdfDestination & rDest,
                                    const PdfString &      rsName)
> with rDest not constructed from a string PdfObject (and a document),
> because otherwise the internal PdfObject of the PdfDestination would become
> a string one, thus that PdfDocument method recording a reference to that
> string, which isn't conforming to the PDF 1.7 spec clause 12.3.2.3 (allowing
> only array and some dictionary).
> I consider this ("otherwise ...") to be a bug in PdfDestination's Init method.
> 
> I would fix the bug I mentioned anyway if you (PoDoFo developer/s) don't give
> me convincing reasons for that being no bug. To give you time for this I'll

> tend to another PoDoFo issue first, I hope today.

Hi all,

I hope I have given enough time for any objections to the above being a bug,
I have fixed it now, the change is attached to this e-mail as a patch.
I have build-tested it without new warnings. Please tell me (on-list) about
any further tests you'd like I do. If any are not required, please review,
apply and commit the patch separately to the public repository.

Best regards, mabri
Index: src/doc/PdfDestination.cpp
===================================================================
--- src/doc/PdfDestination.cpp	(revision 1716)
+++ src/doc/PdfDestination.cpp	(working copy)
@@ -159,6 +159,7 @@
     if ( pObject->GetDataType() == ePdfDataType_Array ) 
     {
         m_array = pObject->GetArray();
+        m_pObject = pObject;
     }
     else if( pObject->GetDataType() == ePdfDataType_String ) 
     {
@@ -178,9 +179,12 @@
             m_array = pValue->GetArray();
         else if( pValue->IsDictionary() )
             m_array = pValue->GetDictionary().GetKey( "D" )->GetArray();
+        m_pObject = pValue;
     }
-
-    m_pObject = pObject;
+    else
+    {
+        PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
+    }
 }
 
 void PdfDestination::AddToDictionary( PdfDictionary & dictionary ) const
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to