Run-Time Check Failure #2 Stack around the variable ‘xxx’ was corrupted
在改别人代码时,运行报错:
Run-Time Check Failure #2 Stack around the variable ‘buffer’ was corrupted
这表明你对某变量的赋值操作,超出了其内存范围。
例,在我的代码中大致是这样的:
char buffer[10];
sprintf(buffer, "D:\\user\\test\\exp10.epoch03.autosave");
很明显,这里我给buffer赋值的字符串长度超出了其定义时分配的内存范围。
找到问题后突然感觉……真是好白痴的问题啊~
不过刚看到时还是挺没有头绪的,尤其是出问题的这个变量还用了buffer这种大众化的名字……
而且这种运行时问题是不会提示哪行出错的,茫茫多代码啊!这回充分体会到步进式debug是多么的重要了。
另外,在网上查看相关问题,几乎都是char[]+sprintf引起的,以后看到可以快速定位了。
相关问题引用:
Run-Time Check Failure #2 - Stack around the variable — was corrupted
奇怪的Stack around the variable was corrupted现象解析 以及 sprintf 的奇怪现象?谁能解释?
Run-Time Check Failure #2 Stack around the variable ‘xxx’ was corrupted的更多相关文章
- VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法
问题 : 在用VS2008写一段代码,算法都没有问题,但是调试的时候发现出了main之后就报 Stack around the variable 'xxx' was corrupted 的错误,后来发 ...
- c++. Run-Time Check Failure #2 - Stack around the variable 'cc' was corrupted.
Run-Time Check Failure #2 - Stack around the variable 'cc' was corrupted. char cc[1024]; //此处如果索引值 ...
- Run-Time Check Failure #2 - Stack around the variable 's' was corrupted. 出现了 。
程序中存在内存越界,注意数组大小和数据大小.
- vs中 Stack around the variable 'XXX' was corrupted.
https://blog.csdn.net/hou09tian/article/details/75042206 把 project->配置属性->c/c++->代码生成->基 ...
- Run-Time Check Failure #2 - Stack around the variable 'ucPriKey' was corrupt
Run-Time Check Failure #2 一般是栈被破坏,你的代码可能有缓冲区溢出一类的问题. Run-Time Check Failure #2 - Sta ...
- Stack around the variable 'szStr' was corrupted.
错误:stack around the variable “XX” was corrupted.,中文翻译就是“在变量XX周围的堆栈已损坏”. 把 project->配置属性->c/c++ ...
- stack around the variable “XX” was corrupted
晚上花了几个小时fix了这个恼人的BUG!“在变量XX周围的堆栈已损坏” 在网上找到的解释是: 把“project->配置属性->c/c++->代码生成->基本运行时检查 设置 ...
- vs中“Stack around the variable was corrupted”的解决方案
把 project->配置属性->c/c++->代码生成->基本运行时检查 为 默认值 就不会报本异常.具体原因正在研究中... 如果改为其他就有exception. exce ...
- 运行时错误:“stack around the variable…was corrupted”
造冰箱的大熊猫@cnblogs 2018/11/1 引发问题的代码片段如下 WORD var; scanf ( "%d", &var ); 包含上述代码的程序,编译正常,运 ...
随机推荐
- snmp简单使用
preface snmp 不多说 环境介绍 1.使用CentOs7的系统,内核版本为3.10.0-123.el7.x86_64 2.ip地址为192.168.56.12 安装snmp 1.yum安装: ...
- python unittest 2
参考资料:http://pyunit.sourceforge.net/pyunit_cn.html :http://docs.python.org/2/library/unittest.html py ...
- 如何破解银行O2O模式创新
文/赵志宏 摩 根大通的买房APP,使客户可根据自己的位置选择合适的贷款经理:华道数据提供的卡惠APP,使客户可随时查询自己周围信用卡刷卡打折的商户信息:民生银 行的微信预约叫号功能,使客户根据可自己 ...
- Track and Follow an Object----4
原创博文:转载请标明出处(周学伟):http://www.cnblogs.com/zxouxuewei/tag/ ntroduction: 在本示例中,我们将探索包含Kinect摄像头的自主行为. 这 ...
- Eclipse------如何将项目通过maven编译并打包
1.右击项目>>>点击Debug As>>>点击 Maven install进行编译,编译成功后入图 2.右击项目>>>点击Debug As> ...
- Dubbo -- 系统学习 笔记 -- 示例 -- 分组聚合
Dubbo -- 系统学习 笔记 -- 目录 示例 想完整的运行起来,请参见:快速启动,这里只列出各种场景的配置方式 分组聚合 按组合并返回结果,比如菜单服务,接口一样,但有多种实现,用group区分 ...
- PHP开发中,让var_dump调试函数输出更美观 ^_^#
前提:php必须安装Xdebug模块. 用var_dump打印输出时,输出的内容没有被格式化.如下图: 通常使用var_dump打印的内容是被格式化后输出的,如下图: 造成没有格式化输出的原因是因为p ...
- 解决SOCKET通信 ERROR_INSUFFICIENT_BUFFER错误
错误发生在服务端异步收到一个socket连接,之后使用WSAGetLastError()得到的IO错误码是122 这个错误码在系统中的解释是The data area passed to a syst ...
- form enctype:"multipart/form-data",method:"post" 提交表单,后台获取不到数据
在解决博问node.js接受参数的时候,发现当form中添加enctype:"multipart/form-data",后台确实获取不到数据,于是跑到百度上查了一下,终于明白为什么 ...
- scala中隐式转换之隐式值和隐式视图
/** * Created by root * Description : 隐式值和隐式视图 */ object ImplicitTest { def main(args: Array[String] ...