MySQL++ - Run-Time Check Failure #2 - Stack around the variable was corrupted

Hello, im having issues with MySQL++ and desperately need help.
I'm using Visual Studio 2010, MySQL++ v3.1.0 and MySQL v5.1.59( x86 & x64 );
All Library's have been compiled correctly. This error only occurs in Debug version due to the compiler setting "Both (/RTC1, equiv. to /RTCsu) (/RTC1)" being on.

I've been raging for 2 days over this problem, and traced it down to the fact that ALL mysqlpp variables that are created on stack, as shown in my code, give this error when they get destroyed on leaving the scope.
The code works perfectly and does what its suppose to in both Debug and Release. So the only problems im having, are these errors showing up in Debug. If they are (which I suppose they are) bugs with the VS10Compiler/MySQL/MySQL++ - I would be happy to do some hack/disabling of warnings that effect only this section of my code (haven't figured out how to either). As already said, the code works like a charm.
Note to my code: I also receive this warning if I comment out everything in between the connection and the disconnection.

Thank you for any help that you can offer.

Output:
1
2
First-chance exception at 0x000007fefdb4cacd in Launcher.exe: Microsoft C++ exception: mysqlpp::BadQuery at memory location 0x0a04f2a0..
Run-Time Check Failure #2 - Stack around the variable 'conn' was corrupted. 


My code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
void CMyClass::Run()
{
    // Everything in here is run on its own thread
    try
    {
        mysqlpp::Connection conn( false );
        if( !conn.connect( SQL_DATABASE, SQL_SERVER, SQL_USERNAME, SQL_PASSWORD, SQL_PORT ) )
        {
            Error( "[SQL] Failed to connect to Listening Server, this game will not show up on the Online List!" );
            return;
        }

        // Get the NAT IP and add to Host info
        mysqlpp::Query query = conn.query();
        query << "SELECT USER();";
        mysqlpp::UseQueryResult res = query.use();
        mysqlpp::Row row = res.fetch_row();

        string sRawIP( row[0].c_str() );
        int nFirst = sRawIP.find_first_of( "@" );
        sRawIP.erase( 0, nFirst+1 );
               
        for( int i = 0, j = 0; true; i++ )
        {
            if( !strcmp( string( sRawIP[i] ), "-" ) )
                j++;

            if( j == 4 )
            {
                sRawIP.erase( i, sRawIP.size() );
                sRawIP.replace( "-", "." );
                string sFormatedIP( sRawIP.c_str() );
                Info( "[SQL] Formated IP: %s", sFormatedIP.c_str() );
                break;
            }
        }
       
        conn.disconnect();
    }
    catch( mysqlpp::BadQuery &e )
    {
        Error( "[SQL] Exception: %s", e.what() );
    }
}
This looks a bit odd:
!strcmp( string( sRawIP[i] ), "-" )
Did you mean to write sRawIP[i]=='-'?
strcmp does it too, the output of that for loop is correct, as I said. The SQL stuff works, the program just complains about corrupted stack memory when leaving the main scope of Run()

As already mentioned on my first post, it seems as if the destructors are buggy or there is something wrong with the memory managment of the mysqlpp variables.
Last edited on
Ok, I've done some more debugging and created a fresh console project. And I received no error.
The only difference in between the two is that one is a DLL project and the other a Console project, but I doubt this is the problem considering the code works, just the memory handling doesn't.
This brings me to the conclusion that the Engine im working with, does some kind of memory management the affects how MySQL++ handles its memory.
The only option I see now is to somehow disable the engines memory manager before the MySQL++ code is run, and re enable it afterwards.
Ive tried undefining and redefining different memory specific defines, which had no effect and still left me with the error.

Is it possible to flip on default memory management and turn it back off during run time?
Or is it maybe possible to temporarily disable this specific warning/error during run time and then reactivate it?
Topic archived. No new replies allowed.