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 John Roper <Jo...@iOra.com> on 2000/06/09 23:18:04 UTC

Possible bug when deleting DOMParser object gives runtime error

Hi,

Sorry to re-post this, but I couldn't find any evidence that it was posted
last time (it's not in the message archives as far as I can tell)....

Please could someone enlighten me as to what's happening below....

I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++ 1.1.0
source (which I have compiled myself). The following code fragment gives a
MSVC++ runtime error when deleting the DOMParser object:

		DOMParser*	pParser = new DOMParser;

		pParser->setDoValidation(false);
		pParser->parse( xmlFile );

		m_XercesNode = (DOM_Node&) pParser->getDocument();

		delete pParser;

MSVC++ runtime error:

Program: TestiOraXML.exe

DAMAGE: after Normalblock (#133) at 0x008a2770

If I change the above code to:

		DOMParser	Parser;

		Parser.setDoValidation(false);
		Parser.parse( xmlFile );

		m_XercesNode = (DOM_Node&) Parser.getDocument();

I get stack corruption. This implies to me that something is using the
DOMParser object as if it were a bigger object and writing outside the
bounds of the DOMParser object.

Is this a bug, or have I done something wrong in my compilation/use?

I have attached the offending XML file, although this may not be implicated.

Many thanks
John Roper
iOra Ltd.
www.iOra.com

[[ TEAMROOM.XML : 5380 in winmail.dat ]]

Re: Possible bug when deleting DOMParser object gives runtime error

Posted by Andy Heninger <an...@jtcsv.com>.
From: "Dean Roddey" <droddey@charmedquark.com

> The obvious thing to check is that you are using the same C++ runtime in
all
> the DLLs. For debug, using "multi-threaded Debug DLL", and for
production
> use "multi-threaded DLL", in all DLLs and the exe.
>

And the last few of the daily builds include both debug and release
DLLs and .libs, with different names.  This should pretty much eliminate
mixing debug and release DLLs, but mixing static and dll libraries will
remain a potential problem.

  -- Andy


Sorry to re-post this, but I couldn't find
> any evidence that it was posted
> > last time (it's not in the message archives as far as I can tell)....
> >
> > Please could someone enlighten me as to what's happening below....
> >
> > I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++
1.1.0
> > source (which I have compiled myself). The following code fragment
gives a
> > MSVC++ runtime error when deleting the DOMParser object:
>
>



Re: Possible bug when deleting DOMParser object gives runtime error

Posted by Dean Roddey <dr...@charmedquark.com>.
It has to all be "Multithreaded Debug DLL" or "Multithreaded DLL", your exe
as well as the DLLs. Otherwise, you are using multiple runtimes.


--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message -----
From: "John Roper" <Jo...@iOra.com>
To: <xe...@xml.apache.org>
Sent: Monday, June 12, 2000 3:06 AM
Subject: RE: Possible bug when deleting DOMParser object gives runtime error


> Thanks for the tip. I've checked the DLL that I'm instantiating the
> DOMParser in, and I've checked the EXE that's calling my DLL and they are
> "multi-threaded Debug DLL" and "multi-threaded Debug". Do I really need to
> make the EXE "multi-threaded Debug DLL" rather than "multi-threaded
Debug"?
> I've re-tried it and I'm fairly sure it's OK. The only thing I'm not 100%
> about is which xerces.DLL I am loading (I'll check this). I see that Andy
is
> changing the DLL names to avoid confusion, but it would be really great if
> the version resource could also show if the DLL was DEBUG or not. There's
a
> "Special Build Description" that would be perfect for this.



RE: Possible bug when deleting DOMParser object gives runtime error

Posted by John Roper <Jo...@iOra.com>.
Thanks for the tip. I've checked the DLL that I'm instantiating the
DOMParser in, and I've checked the EXE that's calling my DLL and they are
"multi-threaded Debug DLL" and "multi-threaded Debug". Do I really need to
make the EXE "multi-threaded Debug DLL" rather than "multi-threaded Debug"?
I've re-tried it and I'm fairly sure it's OK. The only thing I'm not 100%
about is which xerces.DLL I am loading (I'll check this). I see that Andy is
changing the DLL names to avoid confusion, but it would be really great if
the version resource could also show if the DLL was DEBUG or not. There's a
"Special Build Description" that would be perfect for this.

Cheers
John

-----Original Message-----
From: Dean Roddey [mailto:droddey@charmedquark.com]
Sent: 09 June 2000 23:18
To: xerces-c-dev@xml.apache.org
Subject: Re: Possible bug when deleting DOMParser object gives runtime
error


The obvious thing to check is that you are using the same C++ runtime in all
the DLLs. For debug, using "multi-threaded Debug DLL", and for production
use "multi-threaded DLL", in all DLLs and the exe.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message ----- > Sorry to re-post this, but I couldn't find
any evidence that it was posted
> last time (it's not in the message archives as far as I can tell)....
>
> Please could someone enlighten me as to what's happening below....
>
> I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++ 1.1.0
> source (which I have compiled myself). The following code fragment gives a
> MSVC++ runtime error when deleting the DOMParser object:



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Possible bug when deleting DOMParser object gives runtime error

Posted by John Roper <Jo...@iOra.com>.
Problem tracked down take 2...

The problem actually is that we have used #pragma pack(1) in our code, which
means the bools in the DOMParser are packed down to 1 byte, whereas Xerces
doesn't #pragma pack and gets the default packing of 4 bytes. The solution
is for me to #pragma pack(push/pop) appropriately.

Anyway thanks for the help.
Cheers
John

-----Original Message-----
From: John Roper [mailto:John_Roper@iOra.com]
Sent: 15 June 2000 14:28
To: xerces-c-dev@xml.apache.org
Subject: RE: Possible bug when deleting DOMParser object gives runtime
error


I've managed to track down the problem - it's to do with the definition of
bool. In my code there's no special definition of bool, so it defaults to VS
6.0's typedef of 1 byte. However XML4CDefs.h typedefs bool to int iff
NO_NATIVE_BOOL is defined (which it is in MSVCDefs.h). So in my code
DOMParser comes out at 47 bytes, whereas it's 56 bytes inside Xerces...
Hence the stack/heap corruption.

I could fix my code by including XML4CDefs.h before anything else, but I'm
not sure why MSVCDefs.h defines NO_NATIVE_BOOL....

Cheers
John

-----Original Message-----
From: Dean Roddey [mailto:droddey@charmedquark.com]
Sent: 09 June 2000 23:18
To: xerces-c-dev@xml.apache.org
Subject: Re: Possible bug when deleting DOMParser object gives runtime
error


The obvious thing to check is that you are using the same C++ runtime in all
the DLLs. For debug, using "multi-threaded Debug DLL", and for production
use "multi-threaded DLL", in all DLLs and the exe.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message ----- > Sorry to re-post this, but I couldn't find
any evidence that it was posted
> last time (it's not in the message archives as far as I can tell)....
>
> Please could someone enlighten me as to what's happening below....
>
> I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++ 1.1.0
> source (which I have compiled myself). The following code fragment gives a
> MSVC++ runtime error when deleting the DOMParser object:



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Possible bug when deleting DOMParser object gives runtime error

Posted by John Roper <Jo...@iOra.com>.
I've managed to track down the problem - it's to do with the definition of
bool. In my code there's no special definition of bool, so it defaults to VS
6.0's typedef of 1 byte. However XML4CDefs.h typedefs bool to int iff
NO_NATIVE_BOOL is defined (which it is in MSVCDefs.h). So in my code
DOMParser comes out at 47 bytes, whereas it's 56 bytes inside Xerces...
Hence the stack/heap corruption.

I could fix my code by including XML4CDefs.h before anything else, but I'm
not sure why MSVCDefs.h defines NO_NATIVE_BOOL....

Cheers
John

-----Original Message-----
From: Dean Roddey [mailto:droddey@charmedquark.com]
Sent: 09 June 2000 23:18
To: xerces-c-dev@xml.apache.org
Subject: Re: Possible bug when deleting DOMParser object gives runtime
error


The obvious thing to check is that you are using the same C++ runtime in all
the DLLs. For debug, using "multi-threaded Debug DLL", and for production
use "multi-threaded DLL", in all DLLs and the exe.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message ----- > Sorry to re-post this, but I couldn't find
any evidence that it was posted
> last time (it's not in the message archives as far as I can tell)....
>
> Please could someone enlighten me as to what's happening below....
>
> I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++ 1.1.0
> source (which I have compiled myself). The following code fragment gives a
> MSVC++ runtime error when deleting the DOMParser object:



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Possible bug when deleting DOMParser object gives runtime error

Posted by Dean Roddey <dr...@charmedquark.com>.
The obvious thing to check is that you are using the same C++ runtime in all
the DLLs. For debug, using "multi-threaded Debug DLL", and for production
use "multi-threaded DLL", in all DLLs and the exe.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message ----- > Sorry to re-post this, but I couldn't find
any evidence that it was posted
> last time (it's not in the message archives as far as I can tell)....
>
> Please could someone enlighten me as to what's happening below....
>
> I am developing on Win98 using MSVC 6.0 SP3. I have the Xerces C++ 1.1.0
> source (which I have compiled myself). The following code fragment gives a
> MSVC++ runtime error when deleting the DOMParser object: