Re: [Podofo-users] Getting Segmentation fault when ttrying to access PdfVecObjects
Hi Joerg, thanks for this hint. I thought maybe I'am misusing PdfObject::Reference() and PdfObject::GetReference() in my code This could explain the null pointer. I want to get a objects Reference number by calling PdfObject::Reference() and get a pointer to a eventually existing indirect object by calling PdfObject::GetReference(). Is this the correct use case? Thanks in advance! Georg Am Donnerstag, den 10.05.2018, 17:42 +0200 schrieb Joerg Sonnenberger: > On Thu, May 10, 2018 at 02:14:18PM +, Georg Funk wrote: > > Program received signal SIGSEGV, Segmentation fault. > > 0x55ba2342486e in PoDoFo::PdfVariant::DelayedLoad (this=0x0) at > > /usr/local/include/podofo/base/PdfVariant.h:545 > > 545 if( !m_bDelayedLoadDone) > > > > Have you any idea for me? > > Your reference goes to a null pointer. Look at the "this" above. > > Joerg -- 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
Re: [Podofo-users] Getting Segmentation fault when ttrying to access PdfVecObjects
Hi, Am Donnerstag, den 10.05.2018, 18:09 +0200 schrieb zyx: > On Thu, 2018-05-10 at 14:14 +, Georg Funk wrote: > > Have you any idea for me? > > Hi, > what is your exact version of PoDoFo, please? Do your sources include > https://sourceforge.net/p/podofo/code/1825 ? > I am using 0.9.6-rc1. The patch is included. Thanks, Georg -- 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
Re: [Podofo-users] Getting Segmentation fault when trying to access PdfVecObjects
Hi, Matthew, Am Donnerstag, den 10.05.2018, 18:26 +0200 schrieb Matthew Brincke: > [typos fixed and code re-wrapped in quote] > > Hello Georg, hello all, > > On 10 May 2018 at 16:14 Georg Funk wrote: > > > > > > Dear developers, > > > > I'm getting a segmentation fault in the following code snippet when > > resolving IsReference()): > > > > if (objectVector.GetObject(currentReference)->IsReference()) { > > currentReference = objectVector > > .GetObject(currentReference)->GetReference(); > > } > > else {} > > > > objectVector is a global variable here and currentReference holds a > > PdfReference to look up. > > the method PdfVecObjects::GetObject() (your objectVector is of type > PdfVecObjects, right?) can return NULL (nullptr from C++11), this > means that the the reference passed (your currentReference) could > not be resolved (no object with those numbers was found in the > vector). > Then IsReference() would be called with NULL this (undefined > behaviour > AFAIK). > Right, the objectVector is of the type PdfVecObjects. I try to pass the content object of each page to my data model, which has also function above, to build up a recursive Object-Tree. But it fails at the very first invocation. Georg -- 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
Re: [Podofo-users] Getting Segmentation fault when trying to access PdfVecObjects
[typos fixed and code re-wrapped in quote] Hello Georg, hello all, > On 10 May 2018 at 16:14 Georg Funk wrote: > > > Dear developers, > > I'm getting a segmentation fault in the following code snippet when > resolving IsReference()): > > if (objectVector.GetObject(currentReference)->IsReference()) { > currentReference = objectVector > .GetObject(currentReference)->GetReference(); > } > else {} > > objectVector is a global variable here and currentReference holds a > PdfReference to look up. the method PdfVecObjects::GetObject() (your objectVector is of type PdfVecObjects, right?) can return NULL (nullptr from C++11), this means that the the reference passed (your currentReference) could not be resolved (no object with those numbers was found in the vector). Then IsReference() would be called with NULL this (undefined behaviour AFAIK). > > Error message from gdb: > > Program received signal SIGSEGV, Segmentation fault. > 0x55ba2342486e in PoDoFo::PdfVariant::DelayedLoad (this=0x0) at > /usr/local/include/podofo/base/PdfVariant.h:545 > 545 if( !m_bDelayedLoadDone) > There it is, the "this" implicit argument with NULL value, through some extra call(s). > Have you any idea for me? The return value of PdfVecObjects::GetObject() should be stored in a pointer variable which is then checked for NULL (nullptr preferably for C++11 or newer) and used only if it isn't equal to that. > > Thank you! > You're welcome. > Best regards, > Georg Best regards, mabri -- 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
Re: [Podofo-users] Getting Segmentation fault when ttrying to access PdfVecObjects
On Thu, 2018-05-10 at 14:14 +, Georg Funk wrote: > Have you any idea for me? Hi, what is your exact version of PoDoFo, please? Do your sources include https://sourceforge.net/p/podofo/code/1825 ? I do not know whether it's related to your crash, but it sounds quite similar. Bye, zyx -- 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
Re: [Podofo-users] Getting Segmentation fault when ttrying to access PdfVecObjects
On Thu, May 10, 2018 at 02:14:18PM +, Georg Funk wrote: > Program received signal SIGSEGV, Segmentation fault. > 0x55ba2342486e in PoDoFo::PdfVariant::DelayedLoad (this=0x0) at > /usr/local/include/podofo/base/PdfVariant.h:545 > 545 if( !m_bDelayedLoadDone) > > Have you any idea for me? Your reference goes to a null pointer. Look at the "this" above. Joerg -- 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
[Podofo-users] Getting Segmentation fault when ttrying to access PdfVecObjects
Dear developers, I'am getting a segmentation fault in the following code snippet when resolving IsReference()): if (objectVector.GetObject(currentReference)->IsReference()) { currentReference = objectVector.GetObject(currentReference)- >GetReference(); } else {} pbjectVector is a global variable here and currentReference holds a PdfReference to look up. Error messaqge from gdb: Program received signal SIGSEGV, Segmentation fault. 0x55ba2342486e in PoDoFo::PdfVariant::DelayedLoad (this=0x0) at /usr/local/include/podofo/base/PdfVariant.h:545 545 if( !m_bDelayedLoadDone) Have you any idea for me? Thank you! Best regards, Georg -- 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