Bastien Durel Guest
|
Posted: Wed Mar 07, 2007 9:41 pm Post subject: Stack pointer overwriting |
|
|
Hello,
I suffer from a very strange pointer overwriting within BDS2006. I
declare some pointers on the stack, and after evry assignment, their
value becomes 0x1
here is the code :
DataKernel::DB_WSMESSAGE* TWSMsgForm::fMessageFromTree(TTreeNode*
apBase, int* aOrder)
{
DataKernel::DB_WSMESSAGE* lRet=new DataKernel::DB_WSMESSAGE
(mpDBMessage->mWSDLCODE, mpDBMessage->mMETHODCODE,
mpDBMessage->mMESSAGECODE, *aOrder);
if (apBase->HasChildren)
{
DataKernel::DB_WSMESSAGE* lTmpMsg=NULL;
TTreeNode* lit=apBase->getFirstChild();
while (lit)
{
++(*aOrder);
lTmpMsg=fMessageFromTree(lit, aOrder);
lit=apBase->GetNextChild(lit);
if (lTmpMsg)
lRet->AddChild(lTmpMsg);
}
}
[...]
return lRet;
}
within the debugger, I never see lTmpMsg becoming NULL, it always has
a value of 0x1, but if I step into machine code, I see [ebp-$78]
becoming 0 at instruction 009BE944, but it returns to 0x1 at 009BE947.
wsmessagesform.cpp.642: DataKernel::DB_WSMESSAGE* lTmpMsg=NULL;
009BE942 33D2 xor edx,edx
009BE944 895588 mov [ebp-$78],edx
wsmessagesform.cpp.643: TTreeNode* lit=apBase->getFirstChild();
009BE947 8B450C mov eax,[ebp+$0c]
009BE94A E8F92FDEFF call Comctrls::TTreeNode::getFirstChild()
009BE94F 894584 mov [ebp-$7c],eax
I tried declaring a dummy void* pointer under lTmpMsg, and this
pointer was affected, but sometimes the affected memory changes to lit
or lTmpMsg.
I memtested my computer without any error.
Altough I know it's not a debugger display error ( lRet-
| Quote: | AddChild(lTmpMsg) crash dereferencing 0x1 ) I tryed removing objects
and tds files, without success. |
I tryed CodeGuard, but with CodeGard the problem disappears
So, do you have any idea on this problem ?
Thanks,
--
Bastien Durel |
|