after debugging this issue some more I found that the class seems to
change layout/size between

PdfVariant::Clear:

this:0x7e47ba0 &m_bDelayedLoadDone: 0x7e47bb8 sizeof: 32

and

inline void PdfVariant::DelayedLoad() const:

this 0x7e47ba0  bDelayed: 0x7e47bb3 size: 24

seems like some member gets lost in the inline function, which causes
the delayedLoadDone member to appear uninitialized.


Florian


On 06/01/2017 11:54 PM, Florian Hänel wrote:
> I have built podofo 0.9.5 as a dynamic library on linux x64.
>
> the following code aborts in the PdfDocument constructor, but only if
> notcalled exists:
>
> #include "podofo/podofo.h"
>
> int main(int argc, char** argv) {
>     printf("%s:%i\n",__FILE__,__LINE__);
>     PoDoFo::PdfMemDocument* doc = new PoDoFo::PdfMemDocument(); // exception 
> here
>     printf("%s:%i\n",__FILE__,__LINE__);
>     doc->Load("test2-annotated.pdf");
>     printf("%s:%i\n",__FILE__,__LINE__);
> }
>
> void notcalled(PoDoFo::PdfAnnotation* anno) {
>     PoDoFo::PdfObject* obj = anno->GetObject();
>     printf("%i\n", obj->HasStream());
> }
>
> if notcalled does *not* exist, it works as expected.
>
>
> $ g++ -std=gnu++11 podofotest.cpp -L build-podofo-0.9.5/src -l podofo -I
> podofo-0.9.5 -I build-podofo-0.9.5
>
> LD_LIBRARY_PATH=build-podofo-0.9.5/src gdb ./a.out
>
> (gdb) bt
> #0  0x00007ffff7008428 in __GI_raise (sig=sig@entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> #1  0x00007ffff700a02a in __GI_abort () at abort.c:89
> #2  0x00007ffff764184d in __gnu_cxx::__verbose_terminate_handler() ()
> from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> #3  0x00007ffff763f6b6 in ?? () from
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> #4  0x00007ffff763f701 in std::terminate() () from
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> #5  0x00007ffff763f919 in __cxa_throw () from
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> #6  0x00007ffff7a7fd27 in PoDoFo::PdfVariant::DelayedLoadImpl() () from
> build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #7  0x00000000004015b2 in PoDoFo::PdfVariant::DelayedLoad() const ()
> #8  0x00007ffff7a48d9a in PoDoFo::PdfVariant::GetDictionary() () from
> build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #9  0x00007ffff7a7e829 in
> PoDoFo::PdfObject::PdfObject(PoDoFo::PdfReference const&, char const*)
> () from build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #10 0x00007ffff7a9c67f in PoDoFo::PdfVecObjects::CreateObject(char
> const*) () from build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #11 0x00007ffff7ac48b3 in PoDoFo::PdfDocument::PdfDocument(bool) () from
> build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #12 0x00007ffff7b0bf6f in PoDoFo::PdfMemDocument::PdfMemDocument() ()
> from build-podofo-0.9.5/src/libpodofo.so.0.9.5
> #13 0x0000000000400c16 in main ()
>
>
> clang++ and g++ behave the same. valgrind complains about an uninitialized 
> value in the error case
>
>
> Florian 
>
>
> ------------------------------------------------------------------------------
> 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


------------------------------------------------------------------------------
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

Reply via email to