Hi Mike, Thanks for discovering this problem. I agree with you that creating an empty PdfContents object would be the best solution. I commited a fix to SVN which does this. The problem of the current solution is that a contents key is always added to a PdfPage if an empty one was read. It would be better to do this only on demand. But at least the crashes should be gone now.
Best regards,
Dom
Am Dienstag 15 Dezember 2009 schrieb Mike Slegeir:
> Hello,
>
> I think I've stumbled across a program-crashing issue. On line 69 of
> PdfPage.cpp, there's a 'TODO: handle absent contents'; currently, by
> just setting m_pContents = NULL, PoDoFo will segfault when a method such
> as GetContents is called which dereferences the NULL pointer.
> According to the PDF spec, "If [Contents] is absent, the page shall be
> empty." So having a NULL m_pContents might be a reasonable way to
> handle the issue, but the rest of the code will need to test whether
> m_pContents is non-NULL before dereferencing it. I'm not sure if
> there's a simple way to create an 'empty' PdfContents object as that
> would probably be a preferential solution in my opinion.
> If an example document would be helpful, I can provide one, but it
> should be pretty simple to create one if necessary (just a blank PDF
> should do the trick). I'd like to see this resolved because it doesn't
> seem like an extremely difficult issue and it does cause the library to
> segfault on valid PDFs.
>
> Thanks,
> Mike Slegeir
>
> ---------------------------------------------------------------------------
> --- This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
--
**********************************************************************
Dominik Seichter - [email protected]
KRename - http://www.krename.net - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
