# Debugger Lies: Stack Corruption

DevFeed: [Debugger Lies: Stack Corruption](<https://devfeed.tech/articles/debugger-lies-stack-corruption-39722.md>)

Original publisher: [Read original article](<https://www.timdbg.com/posts/debugger-lies-part-1/>)

Author: Tim Misiak

Published: 2022-08-21T16:57:31Z

Content type: tutorial

Language: en

Sources: [TimDbg](<https://devfeed.tech/sources/timdbg.md>)

Topics: [debug](<https://devfeed.tech/topics/debug.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [MSVC](<https://devfeed.tech/topics/msvc.md>), [Security](<https://devfeed.tech/topics/security.md>), [Variable](<https://devfeed.tech/topics/variable.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [crash](<https://devfeed.tech/tags/crash.md>), [debug](<https://devfeed.tech/tags/debug.md>), [debugger](<https://devfeed.tech/tags/debugger.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [local-variables](<https://devfeed.tech/tags/local-variables.md>), [memory](<https://devfeed.tech/tags/memory.md>), [msvc](<https://devfeed.tech/tags/msvc.md>), [security](<https://devfeed.tech/tags/security.md>), [stack](<https://devfeed.tech/tags/stack.md>)

## AI overview

This article explains why debuggers can produce misleading stack walks, focusing on stack corruption caused by buffer overflows that overwrite return addresses. It discusses how MSVC's /GS security checks affect crash stacks and recommends enabling /GS, along with using memory access breakpoints to investigate corruption.

## Source excerpt

There are lots of reasons your debugger might be lying to you. Sometimes it's because information is lost when compiling due to optimizations. Sometimes the symbolic debug information isn't expressive enough. Other times it can be due to a bug in the debugger (although I hope that reason is rare). One frustrating case where the debugger sometimes "lies" to you is the stack walk. It's the single most important piece of information to come out of a crash, so when the stack walk is wrong, it's probably going to make analysis difficult.