[sword-devel] Unusual behavior from diatheke on Linux with musl libc

Isaac Dunham ibid.ag at gmail.com
Wed Jul 9 21:36:35 MST 2014


On Tue, Jul 08, 2014 at 05:33:54PM +0300, Jaak Ristioja wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Looking at corediatheke.cpp this is probably a bug which could be
> found using valgrind. Please try the following command with sword+musl:
> 
>   valgrind --leak-check=full --track-origins=yes
> - --keep-stacktraces=alloc-and-free utils\diatheke -b KJV -k Ps117
> 
> Blessings,
> Jaak

Thank you for the recommendation.

I found it necessary to adjust this to:

$ valgrind --leak-check=full --track-origins=yes \
  --keep-stacktraces=alloc-and-free /lib/ld-musl-i386.so.1 \
  utilities/diatheke/.libs/diatheke  -b KJV -k Ps117 \
  >/tmp/ram/musl-diatheke.txt 2>&1 


The resulting log is very large (>5k lines), and I don't see any obvious
problems. (Not that I'd be likely to!)
If desired, I can attach a zipped or bzipped version.
Following is the part (~80 lines) that's most likely to be interesting.

Thank you,
Isaac Dunham

==4701==    by 0x4809CBA: DiathekeMgr::DiathekeMgr(sword::SWConfig*, sword::SWConfig*, bool, char, char, bool, bool) (diathekemgr.cpp:40)
==4701==    by 0x48074CE: doquery(unsigned long, unsigned char, unsigned char, unsigned long, unsigned char, char const*, char const*, char const*, char const*, std::ostream*, char const*, signed char) (corediatheke.cpp:117)
==4701==    by 0x480452F: main (diatheke.cpp:286)
==4701== 
==4701== Conditional jump or move depends on uninitialised value(s)
==4701==    at 0x1297FE: calloc (calloc.c:19)
==4701==    by 0x485D864: sword::ListKey::add(sword::SWKey const&) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4865BD6: sword::ListKey::operator<<(sword::SWKey const&) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4864F4D: sword::VerseKey::parseVerseList(char const*, char const*, bool, bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486366E: sword::VerseKey::parse(bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4865CCD: sword::VerseKey::setText(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4863D17: sword::VerseKey::parseVerseList(char const*, char const*, bool, bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4807F21: doquery(unsigned long, unsigned char, unsigned char, unsigned long, unsigned char, char const*, char const*, char const*, char const*, std::ostream*, char const*, signed char) (corediatheke.cpp:386)
==4701==    by 0x480452F: main (diatheke.cpp:286)
==4701==  Uninitialised value was created
==4701==    at 0x12385D: ??? (syscall.s:35)
==4701==    by 0x12A488: malloc (malloc.c:379)
==4701==    by 0x48094E5: sword::SWBuf::assureSize(unsigned int) (swbuf.h:62)
==4701==    by 0x48691FE: sword::SWBuf::SWBuf(sword::SWBuf const&, unsigned long) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486D5C6: ??? (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486E6D2: std::_Rb_tree<sword::SWBuf, std::pair<sword::SWBuf const, sword::SWBuf>, std::_Select1st<std::pair<sword::SWBuf const, sword::SWBuf> >, std::less<sword::SWBuf>, std::allocator<std::pair<sword::SWBuf const, sword::SWBuf> > >::_M_insert_equal(std::pair<sword::SWBuf const, sword::SWBuf> const&) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486DE24: sword::SWConfig::Load() (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486E060: sword::SWConfig::SWConfig(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x487E967: sword::SWLocale::SWLocale(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x487FBC9: sword::LocaleMgr::loadConfigDir(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4880245: sword::LocaleMgr::LocaleMgr(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x488045B: sword::LocaleMgr::getSystemLocaleMgr() (in /usr/lib/libsword-1.7.3.so)
==4701== 
==4701== Conditional jump or move depends on uninitialised value(s)
==4701==    at 0x1297FE: calloc (calloc.c:19)
==4701==    by 0x4891599: sword::ZipCompress::Decode() (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4890801: sword::SWCompress::Buf(char const*, unsigned long*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x489485F: sword::zVerse::zReadText(char, long, unsigned short, unsigned long, sword::SWBuf&) const (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x48E3863: sword::zText::getRawEntryBuf() const (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4887B00: sword::SWModule::renderText(char const*, int, bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4808734: doquery(unsigned long, unsigned char, unsigned char, unsigned long, unsigned char, char const*, char const*, char const*, char const*, std::ostream*, char const*, signed char) (corediatheke.cpp:424)
==4701==    by 0x480452F: main (diatheke.cpp:286)
==4701==  Uninitialised value was created
==4701==    at 0x12385D: ??? (syscall.s:35)
==4701==    by 0x12A488: malloc (malloc.c:379)
==4701==    by 0x48094E5: sword::SWBuf::assureSize(unsigned int) (swbuf.h:62)
==4701==    by 0x48691FE: sword::SWBuf::SWBuf(sword::SWBuf const&, unsigned long) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486D5C6: ??? (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486E6D2: std::_Rb_tree<sword::SWBuf, std::pair<sword::SWBuf const, sword::SWBuf>, std::_Select1st<std::pair<sword::SWBuf const, sword::SWBuf> >, std::less<sword::SWBuf>, std::allocator<std::pair<sword::SWBuf const, sword::SWBuf> > >::_M_insert_equal(std::pair<sword::SWBuf const, sword::SWBuf> const&) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486DE24: sword::SWConfig::Load() (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486E060: sword::SWConfig::SWConfig(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x487E967: sword::SWLocale::SWLocale(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x487FBC9: sword::LocaleMgr::loadConfigDir(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4880245: sword::LocaleMgr::LocaleMgr(char const*) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x488045B: sword::LocaleMgr::getSystemLocaleMgr() (in /usr/lib/libsword-1.7.3.so)
==4701== 
Psalms 117:1: O praise the LORD, all ye nations: praise him, all ye people.
==4701== Conditional jump or move depends on uninitialised value(s)
==4701==    at 0x1214DF: __funcs_on_exit (atexit.c:23)
==4701==    by 0x121625: exit (exit.c:22)
==4701==    by 0x120E1A: (below main) (__libc_start_main.c:76)
==4701==  Uninitialised value was created
==4701==    at 0x12385D: ??? (syscall.s:35)
==4701==    by 0x12A488: malloc (malloc.c:379)
==4701==    by 0x48094E5: sword::SWBuf::assureSize(unsigned int) (swbuf.h:62)
==4701==    by 0x48691FE: sword::SWBuf::SWBuf(sword::SWBuf const&, unsigned long) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x48777FB: std::_Rb_tree<sword::SWBuf, std::pair<sword::SWBuf const, sword::SWOptionFilter*>, std::_Select1st<std::pair<sword::SWBuf const, sword::SWOptionFilter*> >, std::less<sword::SWBuf>, std::allocator<std::pair<sword::SWBuf const, sword::SWOptionFilter*> > >::_M_insert_unique(std::pair<sword::SWBuf const, sword::SWOptionFilter*> const&) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x48702D3: sword::SWMgr::init() (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x486F889: sword::SWMgr::commonInit(sword::SWConfig*, sword::SWConfig*, bool, sword::SWFilterMgr*, bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x48748B9: sword::SWMgr::SWMgr(sword::SWConfig*, sword::SWConfig*, bool, sword::SWFilterMgr*, bool) (in /usr/lib/libsword-1.7.3.so)
==4701==    by 0x4809CBA: DiathekeMgr::DiathekeMgr(sword::SWConfig*, sword::SWConfig*, bool, char, char, bool, bool) (diathekemgr.cpp:40)
==4701==    by 0x48074CE: doquery(unsigned long, unsigned char, unsigned char, unsigned long, unsigned char, char const*, char const*, char const*, char const*, std::ostream*, char const*, signed char) (corediatheke.cpp:117)
==4701==    by 0x480452F: main (diatheke.cpp:286)
==4701== 
Psalms 117:2: For his merciful kindness is great toward us: and the truth of the LORD endureth for ever. Praise ye the LORD. 
: For his merciful kindness is great toward us: and the truth of the LORD endureth for ever. Praise ye the LORD. 
(KJV)
==4701== 
==4701== HEAP SUMMARY:
==4701==     in use at exit: 0 bytes in 0 blocks
==4701==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==4701== 
==4701== All heap blocks were freed -- no leaks are possible





More information about the sword-devel mailing list