On Wed, 2016-05-04 at 17:09 +0000, zyx wrote:
> On Fri, 2016-04-29 at 19:16 +0000, Matthew Brincke wrote:>> the bugfix
> attached to the e-mail this replies to is very strict:
> Hi,
> thanks for the patch, though the strict part is a "problem". Consider
> that the PDF files are created by various clients/libraries, not always
> fully conforming to the PDF specification and this limitation, an
> exception being thrown when one tries to read such "broken" PDF file,
> will not help, because it'll just avoid a PDF file open, without any
> way to cure the error. It can be better to know about the error than
> left it unnoticed in some cases, no doubt, but I'm afraid some users
> would consider this new behaviour as a regression from the previous
> PoDoFo versions.
Hi,
now I have de-fanged the bugfix in the patch attached, it now only
throws when the preprocessor symbol PODOFO_THROW_ON_UNSUPPORTED is
#define'd: it's not right now, it just logs an error and constructs
an object with an empty destination array.
>> ...right after the bugfix is committed (no earlier, it's a
>> dependency).
>
>> If you merge the two patches into one and thus the trunk will stay
> "backward compatible", then it's a better option then the patch split.
Now it stays backward-compatible IMO without merging and it's no patch split
because this one is a bugfix and the next one I'll deliver will be the
sought-after new feature for reading PDF version-1.1-compatible destinations.
So please test (I've build-tested it static & shared native), apply, commit
it separately to the public repository (the file gives a hint for the message).
> Bye,
> zyx
Best regards, mabri
Index: src/doc/PdfDestination.cpp
===================================================================
--- src/doc/PdfDestination.cpp (revision 1722)
+++ 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,20 @@
m_array = pValue->GetArray();
else if( pValue->IsDictionary() )
m_array = pValue->GetDictionary().GetKey( "D" )->GetArray();
+ m_pObject = pValue;
}
-
- m_pObject = pObject;
+ else
+ {
+ PdfError::LogMessage( eLogSeverity_Error, "Unsupported object given to"
+ " PdfDestination::Init of type %s", pObject->GetDataTypeString() );
+#ifdef PODOFO_THROW_ON_UNSUPPORTED // not set in build system (yet?)
+ PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
+#else
+ m_array = PdfArray(); // needed to prevent crash on method calls
+ // needed for GetObject() use w/o checking its return value for NULL
+ m_pObject = pDocument->GetObjects()->CreateObject( m_array );
+#endif
+ }
}
void PdfDestination::AddToDictionary( PdfDictionary & dictionary ) const
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users