You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Dave Viner <dv...@yahoo-inc.com> on 2000/12/07 23:33:59 UTC

seg fault on DOMParser->parse()

I'm running into a problem trying to parse a string out of a memory
buffer.  I'm using xerces inside apache... 

I create a MemBufInputSource (exactly like the MemParse sample), then
reset my DOMParser, then pass the memory buffer to the parser

code:
   MemBufInputSource *memBufIS = new MemBufInputSource ( 
                                  (const XMLByte *)inString,
                                  strlen(inString),
                                  memBufId,
                                  false );
//
xmlDomParser->reset();
 xmlDomParser->parse( *memBufIS );


Inside the parse call, the server segfaults.  from gdb, it appears the
problem is:
#0  0x2836e7c4 in NameIdPool<DTDElementDecl>::removeAll (this=0x81b4520)
    at
/homes/dviner/xml/clean5/xerces-c-src1_3_0/include/util/NameIdPool.c:175
175                 delete curElem->fData;

#1  0x283206d0 in DTDValidator::reset (this=0x81b3b00) at
DTDValidator.cpp:495
#2  0x2835f047 in XMLScanner::scanReset (this=0x81cae00, src=@0x82f6640)
    at XMLScanner2.cpp:699
#3  0x28359d2c in XMLScanner::scanDocument (this=0x81cae00,
src=@0x82f6640, 
    reuseValidator=false) at XMLScanner.cpp:293
#4  0x28314728 in DOMParser::parse (this=0x81b3a80, source=@0x82f6640, 
    reuseValidator=false) at DOMParser.cpp:253


Here are the surrounding lines from NameIdPool.c:

template <class TElem> void NameIdPool<TElem>::removeAll()
{
    // Clean up the buckets first
    for (unsigned int buckInd = 0; buckInd < fHashModulus; buckInd++)
    {
        NameIdPoolBucketElem<TElem>* curElem = fBucketList[buckInd];
        NameIdPoolBucketElem<TElem>* nextElem;
        while (curElem)
        {
            // Save the next element before we hose this one
            nextElem = curElem->fNext;

            delete curElem->fData;
            delete curElem;

            curElem = nextElem;
        }


Has anyone seen this problem?  It seem like the deleting the fData
element causes problems when the class is DTDElementDecl..

Suggestions on how to fix this?

thanks
dave

-- 
"I'm thankful for the grey hairs in my mohawk"
  -- Red Hot Chili Peppers guy at MTV music awards show