C++ 中的堆栈损坏 [英] Stack corruption in C++

查看:23
本文介绍了C++ 中的堆栈损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C++ 中,堆栈可能会被破坏.我猜的一种方法是通过访问超出其边界的数组来覆盖堆栈变量.有没有其他方法可以损坏它?

In C++, in which way the stack may get corrupted. One way I guess is to overwriting the stack variables by accessing an array beyond its boundaries. Is there any other way that it can get corrupted?

推荐答案

  1. 你可以有一个随机/未定义的指针,最终指向堆栈,然后写.
  2. 汇编函数可能会错误地设置/修改/恢复堆栈
  3. 宇宙波可以翻转堆栈中的位.
  4. 芯片外壳中的放射性元素可能会翻转位.
  5. 内核中的任何内容都可能出错并意外更改您的堆栈内存.

但这些并不是 C++ 特有的,它不知道堆栈.

But those are not particular to C++, which doesn't have any idea of the stack.

这篇关于C++ 中的堆栈损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆