C++ Visual Studio Runtime Error

Can anyone explain to me what this means?

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

Answers


When calling a function, the compiler has to push some arguments on the stack, or put them in some registers. The function body will change some memory location (or a register) to contain the return value. Then it will return to a block of code at a location stored 'somewhere' on the stack.

The calling convention specifies the concrete details: e.g. first push the return address, then push arguments (input or output) on the stack from left to right, then execute the function, pop the arguments off again, then pop the return address and jump to that location.

If the caller does this differently than the function expects, things can go wrong (return location is not at the expected stack position).

ESP is typically the register containing the address of the current stack frame. This register is used in combination with indexes to obtain arguments in the function body. When returning, the stack top is typically reset to ESP, and the processor jumps to the location at e.g. ESP+1.

Things that may cause this to happen:

  • someone wrote over the values of the stack and changed the return location (e.g. buffer overflow)
  • the caller had a different calling convention than the callee

Need Your Help

Completely wipe data beyond recovery

hard-drive macbookpro computer-forensics

I'm going to be selling my Macbook pro within the next few days, however I've got a lot of personal documentation, banking information, income documents etc, all sensitive data on there. I'm actually

Sharepoint powershell to associate a site template

sharepoint templates powershell migration

During database detach and attach process, all the sites are migrated to the new 2010 farm but are not yet associated with any site template. I want to be able to run through all the sites that do ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.