Stack Check Support in Microsoft Visual Studio*
Microsoft Visual Studio supports a stack guard function. “Compiler Security Checks In Depth” [MSVC] [1]
introduces the detail on how it works. There are 2 compiler options related:/GS
and /RTC
.
/GS
[MSVC_GS] [2] is designed to detect some buffer overruns that overwrite a function's return address. It is similar to the stack guard feature described above.
/RTCs
[MSVC_RTC] [3] is designed to put 2 tags around (before and after) all individual buffers allocated on the stack. Therefore, both overruns and underflows can be caught.
See figure 1-3 Microsoft* Stack Check.
Figure 1-3 – Microsoft Stack Check
[1] [MSVC] Compiler Security Checks In Depth