buffer overwrite debugging in VC++

Started by
14 comments, last by daniel_i_l 17 years, 8 months ago
Are you storing an iterator in a class which base class doesn't have a virtual destructor?
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
Advertisement
Ok, I did the watch variable and found the lines that make the problem, they are:

m_vCollisions.Body1->m_MyState.AngularVelocity += (Impulse/state_a.MomentOfInertia)*(R_ap.Dot(Normal)); m_vCollisions.Body2->m_MyState.AngularVelocity -= (Impulse/state_b.MomentOfInertia)*(R_bp.Dot(Normal));


could that cause a problem?
Thanks.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Well, the obvious questions are:
  • Is i within permitted index values?
  • Does content of the array at index i have a valid Body1 pointer to an existing object?
  • -yes
    -yes

    I still can't figure out what the problem is:(
    When it gets to th\t line it doesn't always crash, it seems to crash sort of randomly. What could this mean?
    Thanks.
    "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
    What version of VC++ are you using? VC2005's STL implementation will break to the debugger if you access an invalid location in the vector, which pre-VC2005 STL implementations don't do.

    It's usually impossible to tell if one line of code is going to cause a problem, it like saying "Have I used to correct version of the word 'there'?" - It's absolutely impossible to tell without some sort of context.
    I'm using Express - 2005. I got this on msdn:
    Quote:
    To use the debug build to check for memory overwrite, you must first rebuild your project for debug. Then, go to the very beginning of your application's InitInstance function and add the following line:

    afxMemDF |= checkAlwaysMemDF;


    What is the InitInstance function and were do I find it?
    Thanks.
    "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky

    This topic is closed to new replies.

    Advertisement