BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stack pointer overwriting

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language)
View previous topic :: View next topic  
Author Message
Bastien Durel
Guest





PostPosted: Wed Mar 07, 2007 9:41 pm    Post subject: Stack pointer overwriting Reply with quote



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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.