Stack Corruption
-
Upload
chittaranjan-baral -
Category
Documents
-
view
219 -
download
0
description
Transcript of Stack Corruption
-
7/4/2015 Stackcorruption
http://www.keil.com/forum/59751/ 1/1
Products Download Events Support SearchForum Go
ProductsDevelopmentToolsARMC166C51C251VisionIDEandDebugger
Hardware&CollateralULINKDebugAdaptorsEvaluationBoardsProductBrochuresDeviceDatabaseDistributors
DownloadsMDKARMC51C166C251Filedownloads
SupportKnowledgebaseDiscussionForumProductManualsApplicationNotes
ContactDistributorsRequestaQuoteSalesContacts
ContactUs|SiteFeedback|TermsofUse|PrivacyPolicyCopyright2015ARMLtdandARMGermanyGmbH.Allrightsreserved.
Home/DiscussionForum
StackcorruptionNextThread|ThreadList|PreviousThread StartaThread|Settings
Details Message
Reply
AuthorKumarReddyPosted20May201513:24GMTToolsetARM
StackcorruptionHello,
IamworkingonAT91SAM9G20,Keil5.10.Iampassingaconstantstructurepointertoafunction.
typedefstruct{intTestintOkFlag}StructNode
typedefconstStructNode*constNode_t
afterpassingthenode3timesrecursivelythroughafunction
stackdataisgettingcorrupted.
AmIdoinganymistake,Pleasesuggest.
Reply
AuthorPerWestermarkPosted20May201513:44GMTToolsetARM
RE:StackcorruptionSohaveyouverifiedthatthestackisbigenough?Andhaveyouverifiedifthereareotherstructuresthatareneighbourwiththestackandmightoverwritethestack?Andhaveyouverifiedyouruseofpointersorarraystocheckforuseofinvalidpointersoroutofboundsaccessestoarrays?
Reply
AuthorKumarReddyPosted20May201513:58GMTToolsetARM
RE:StackcorruptionIhaveabundantstack,Iamnotmodifyinganydatainsidethefunction,Ihavetrimmedthefunctiontominimal,forjustpassingaduplicatenodebutdatavariablespresentinthefirstcalleraregettingcorrupted.
Iamtypecastingaautovariabletoconsttype
StructNodeNodeNode_tNodePtr=&Node
IsuspecttheremightbeissuewithNode_ttypecastfromNode
Reply
AuthorReinhardKeilPosted28May201512:25GMTToolsetARM
RE:StackcorruptionPassinganaddressofastackbasedvariablecanbetrickysincethelifetimeofthevariableendsatthefunctionreturn.
Whenthereferencepointerofsuchavariableisusedafterthat,yougetastackcorruption.Isuggestthatyouanalyzeyourprogramforsuchascenario.
NextThread|ThreadList|PreviousThread StartaThread|Settings
Importantinformation
Don'tshowthismessageagain
ChangeSettings
Thissiteusescookiestostoreinformationonyourcomputer.Bycontinuingtouseoursite,you
consenttoourcookies.