According to this new stack trace, xerces library tried to allocate 12 bytes

#3 0xb6d57508 in xercesc_3_1::MemoryManagerImpl::allocate (this=0x26f20, size=12)
    at xercesc/internal/MemoryManagerImpl.cpp:40

then c++ library called malloc to allocate 4294967295 bytes

#1  0xb6fb2b30 in malloc (n=4294967295) at src/malloc/malloc.c:346
#2  0xb6a76a30 in operator new(unsigned int) ()
from /home/dupes/data/projects/epri/cea2045/openwrt/source/rpi/openwrt/scripts/../staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.15_eabi/root-brcm2708/usr/lib/libstdc++.so.6

and then received SIGSEGV inside malloc.c

#0  0xb6fb1fc4 in unbin (c=c@entry=0xb69e9348, i=i@entry=42)
    at src/malloc/malloc.c:219

I see no pointers that the problem is in the xerces library.

Good luck!
   Vitaly

Benjamin DuPont wrote:
I turned off optimizations so the parameters aren't hidden. I don't think malloc is actually trying to allocate a max int memory block.

Here's the new stack trace:

Program received signal SIGSEGV, Segmentation fault.
0xb6fb1fc4 in unbin (c=c@entry=0xb69e9348, i=i@entry=42) at src/malloc/malloc.c:219
219        c->next->prev = c->prev;
(gdb) bt
#0  0xb6fb1fc4 in unbin (c=c@entry=0xb69e9348, i=i@entry=42)
    at src/malloc/malloc.c:219
#1  0xb6fb2b30 in malloc (n=4294967295) at src/malloc/malloc.c:346
#2  0xb6a76a30 in operator new(unsigned int) ()
from /home/dupes/data/projects/epri/cea2045/openwrt/source/rpi/openwrt/scripts/../staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.15_eabi/root-brcm2708/usr/lib/libstdc++.so.6 #3 0xb6d57508 in xercesc_3_1::MemoryManagerImpl::allocate (this=0x26f20, size=12)
    at xercesc/internal/MemoryManagerImpl.cpp:40
#4 0xb6c3c9f4 in xercesc_3_1::ValueHashTableOf<bool, xercesc_3_1::StringHasher>::put (this=0xb6fff4a8, key=0xb6ea61f8 <xercesc_3_1::gEncodingArray+14720>, valueToAdopt=@0xbefffdf3: true) at ./xercesc/util/ValueHashTableOf.c:203
#5  0xb6c3c1e0 in xercesc_3_1::EncodingValidator::initializeRegistry (
    this=0xb6fff490) at xercesc/util/EncodingValidator.cpp:79
#6  0xb6c3c054 in xercesc_3_1::EncodingValidator::EncodingValidator (
    this=0xb6fff490) at xercesc/util/EncodingValidator.cpp:50
#7 0xb6c3bf6c in xercesc_3_1::XMLInitializer::initializeEncodingValidator ()
    at xercesc/util/EncodingValidator.cpp:35
#8  0xb6c7ff08 in xercesc_3_1::XMLInitializer::initializeStaticData ()
    at xercesc/util/XMLInitializer.cpp:44
#9  0xb6c3ec78 in xercesc_3_1::XMLPlatformUtils::Initialize (
    locale=0x21004 <xercesc_3_1::XMLUni::fgXercescDefaultLocale> "en_US",
    nlsHome=0x0, panicHandler=0x0, memoryManager=0x0)
    at xercesc/util/PlatformUtils.cpp:307
#10 0x00010858 in main ()


On 10/04/2016 09:56 AM, Vitaly Prapirny wrote:
I know nothing about your platform. If I understand your stack trace correctly, the library failed to allocate block of 4294967168 bytes.

You can try to rebuild xerces with
typedef unsigned long XMLSize_t;

Or simply add debug output into the 'void ValueHashTableOf<TVal, THasher>::rehash()' near ./xercesc/util/ValueHashTableOf.c:225 and see why the library wants to allocate so huge block.

Good luck!
   Vitaly

Benjamin DuPont wrote:
Thanks Vitaly. Do you have any tips on how to fix this? Looks to be defined as a size_t which is probably correct:

#define XERCES_SIZE_T size_t

typedef XERCES_SIZE_T                XMLSize_t;

Ben


On 10/04/2016 02:10 AM, Vitaly Prapirny wrote:
Hi Benjamin,

Seems like XMLSize_t type has been defined incorrectly on your platform.

Good luck!
   Vitaly

Benjamin DuPont wrote:
I'm trying to build xerces for OpenWRT on the rpi zero. xerces segfaults in XMLPlatformUtils::Initialize(). I've tried 3.1.1, 3.1.2, and 3.1.4 all with the same result. I'm building with the following arguments:

    --disable-pretty-make \
    --enable-transcoder-iconv \
    --enable-netaccessor-socket \
    --enable-msgloader-inmemory

Here's the stack trace:

#0 0xb6fb1fc4 in unbin (c=c@entry=0xb6bad348, i=i@entry=42) at src/malloc/malloc.c:219
#1  0xb6fb2b30 in malloc (n=4294967168) at src/malloc/malloc.c:346
#2  0xb6c3aa30 in operator new(unsigned int) ()
from /home/dupes/data/projects/epri/cea2045/openwrt/source/rpi/openwrt/scripts/../staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.15_eabi/root-brcm2708/usr/lib/libstdc++.so.6 #3 0xb6e34268 in xercesc_3_1::MemoryManagerImpl::allocate (this=<optimized out>, size=<optimized out>) at xercesc/internal/MemoryManagerImpl.cpp:40 #4 0xb6db9e1c in xercesc_3_1::ValueHashTableOf<bool, xercesc_3_1::StringHasher>::rehash ( this=this@entry=0xb6f88438) at ./xercesc/util/ValueHashTableOf.c:225 #5 0xb6db9a3c in xercesc_3_1::ValueHashTableOf<bool, xercesc_3_1::StringHasher>::put ( valueToAdopt=<optimized out>, key=0xb6ed0ae6 <xercesc_3_1::gEncodingArray+15088>,
    this=0xb6f88438) at ./xercesc/util/ValueHashTableOf.c:186
#6 xercesc_3_1::EncodingValidator::initializeRegistry (this=this@entry=0xb6f88420)
    at xercesc/util/EncodingValidator.cpp:79
#7 0xb6db9b38 in xercesc_3_1::EncodingValidator::EncodingValidator (this=0xb6f88420)
    at xercesc/util/EncodingValidator.cpp:50
#8 0xb6db9b5c in xercesc_3_1::XMLInitializer::initializeEncodingValidator ()
    at xercesc/util/EncodingValidator.cpp:34
#9 0xb6dd80fc in xercesc_3_1::XMLInitializer::initializeStaticData ()
    at xercesc/util/XMLInitializer.cpp:44
#10 0x000105c4 in main ()







Reply via email to