Jump to content
  • Advertisement
Sign in to follow this  
Thevenin

Boundschecker "Problem Detected:" (Abandoned)

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to find a memory overflow in my server. I just booted up the trial for Boundschecker and ran my app, and I got this (My first thought was, 'Wow, that was quick. All my problems will be solved in a few minutes!', however, I couldn't find which line this was occuring on in my source. I started commenting out functions in my main() when I noticed, main wasn't even being called: it would appear Boundschecker is argueing about the C Standard Library o.O I'm using VS6, any idea why this is occuring? [depressed] Image Hosted by ImageShack.us Edit: I just ran this in it, and it worked fine. I have no clue whats going on ...
#include "winsock.h"
#include "windows.h"
#include "mmsystem.h"
#include <stdio.h>
#include "string.h"
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <time.h>

void main()
{
	char *hello;

	hello = malloc(10);
	memset(hello,0,10);
	printf("Hellow fellows");
}







Edit: I made a fresh project, imported all my files, linked the librarys and ran it, and got this... "First-chance exception in servMain.exe (WCORE.DLL): 0xC0000005: Access Violation." This was before it even loaded main()... [depressed] [Edited by - Thevenin on July 29, 2005 2:06:57 AM]

Share this post


Link to post
Share on other sites
Advertisement
Well, I was just going to call BoundsChecker POS software, and uninstall it, but in my crazed search to get it working, I pushed the "Continue" button.

I got about eight more of those same errors, and than this interesting (And helpful) one that described how my TCPShift() function wasn't moving memory safely since the source and destination overlapped, I quickly investigated this and found it was true, and so I thought to myself 'Wow, this all pays off now'.

After those first eight, and than this one, it gave no more errors until I shut the server off, in which case I got these...

Quote:
First-chance exception in Server.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in Server.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in Server.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in Server.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in Server.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in Server.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.


And of course, the always heart-breaking...
Image Hosted by ImageShack.us

Edit: Just a reminder, I got NONE of these errors reported before installing BoundsChecker.

Share this post


Link to post
Share on other sites
That means that the problem is with one of your global or static variables. If you think about it, they must be constructed before main so that if they were used in the very first line of main, they would be initialised.

You have to be careful that your globals aren't relying on each other to be initialised because you can't really determine the order in which they are created.

Be careful not to kid yourself that your program was just fine before you used Bounds Checker. Just because it is able to detect problems that you thought you didn't have, doesn't mean you should ignore them as if it had never told you.

Start commenting out globals (and code relying on them) until the problem goes away.

Share this post


Link to post
Share on other sites
Interesting, but this only applies to C++ right? I should have mentioned, I'm working in Procedural-C.

My global varibles, never the less...
/* Game related. */
struct gtRGB goColor;

/* The total number of creatures in Fleurin. */
unsigned int guiObjects;

/* 'Heap' related. */
struct gtTile *gaoMap;
struct gtObject *gaoObjects;
struct gtClient *gaoClients;
struct gtContainer *gaoContainers;
struct gtItemDefinition *gaoItemDefinitions;
char *gacTCPSend;
char *gacDebug;

/* Control Related. */
int giIdealFPS;
double gdRealFPS;
unsigned int guiFingerPrint=0;
unsigned int guiMaxCreatures=0;
unsigned short gusSpawnX, gusSpawnY;

/* Winsock Related. */
struct sockaddr_in goServAddr;
SOCKET guiListeningSocket;
int giClientsConnected;
struct timeval goTimeout;

/* Timing Related */
LARGE_INTEGER goCurrentTick;
LARGE_INTEGER goLastTick;
LARGE_INTEGER goFreq;
int giRawTime;
struct tm *gpoTimeInfo;




...would you believe I wrote a MMORPG with that few globals [cool] (Of course, this is just the server, the client has five times that many)

Edit: I'm starting to think it has todo with the Winsock library, since the client code doesn't give these errors...

[Edited by - Thevenin on July 29, 2005 1:28:55 AM]

Share this post


Link to post
Share on other sites
Yay! I've isolated it!

(err.. actually, I was merly forgetting to turn on "Integrated Error Detection".

#include <stdio.h>
void main()
{
char *guy;

guy = malloc(100);

strcpy(guy, "hello fellows");


printf("Buffer overflow not been made (yet)."
"\nHave nice day..");

}





This code gives the same error I'm having way up above...


Edit: ... so does this...
void main()
{
printf("\nHave nice day..");
}




Infact, just a mere printf makes some pretty bad access violations..
Quote:
First-chance exception in setser.exe (MSDIA20.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (MSDIA20.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in setser.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.


<cough> POS software </cough>

Share this post


Link to post
Share on other sites
Sorry for wasting your time guys..

I'm sure BoundsChecker is great for some people, but I don't have the time nor patience to try to find out why it hates C code (I get this alot), especially while its pestering me to purchase a license every two minutes... [flaming]

imalc's ratings++;

Image Hosted by ImageShack.us

Share this post


Link to post
Share on other sites
Ah, it indeed looks like it's not being a very helpful tool. Bummer![dead]

I know it can be useful, because I know people who use it. Some amount of exceptions can be normal under normal usage (provided they're caught), but I wouldn't have expected so many access violations.

I wouldn't like to waste time figuring out which ones were important and which weren't either, so I can totally understand ditching it.
Just make sure you have plenty of asserts etc instead, to help catch bugs.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!