ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Finding errors where indexes goes beyond their boudaries
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Jens Bęk Nielsen



Joined: 07 Jul 2011
Posts: 206
Location: Denmark

PostPost subject: Finding errors where indexes goes beyond their boudaries    Posted: Sun May 06, 2012 6:34 pm Reply to topic Reply with quote

My compiler DevCpp shows there is "An access Violation (Segmentation Fault)" in my chessprogram Dabbaba.

But it is caused by some wrong input - something has been corrupted earlier in the calculations.

I have made a little test to see if DevCpp can detect such things like this:


char testIdx;
char test50a[50];
char test50b[50];


testIdx=75; // outside the array

// ok to read from outside the array?
test50a[25]=test50a[testIdx];

// ok to write outside the array?
test50a[testIdx]=test50a[25];


But DevCpp does not complain about this - everything happens within the program.
And I think this is the way how some of my data is corrupted.

I have tried CppCheck - and it can spot the errors in my little test.
But in a complex program the index is not set to a wrong value right before it is used.

I wonder if there exists an compiler option, that makes it generate code so the program always checks the index boundaries?

Or is there only the hard way to find the error....
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Sun May 06, 2012 6:34 pm
      Re: Finding errors where indexes goes beyond their boudaries Dan Honeycutt Sun May 06, 2012 6:45 pm
      Re: Finding errors where indexes goes beyond their boudaries Sven Schüle Sun May 06, 2012 9:46 pm
            Re: Finding errors where indexes goes beyond their boudaries Jim Ablett Sun May 06, 2012 11:14 pm
                  Re: Finding errors where indexes goes beyond their boudaries Julien MARCEL Sun May 06, 2012 11:26 pm
      Re: Finding errors where indexes goes beyond their boudaries Jim Bell Mon May 07, 2012 11:16 am
      Re: Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Mon May 07, 2012 3:07 pm
            Re: Finding errors where indexes goes beyond their boudaries Sven Schüle Wed May 09, 2012 4:08 pm
                  Re: Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Sun May 13, 2012 10:31 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
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, 2005 phpBB Group
Enhanced with Moby Threads