https://blog.csdn.net/hou09tian/article/details/75042206

  1. 把 project->配置属性->c/c++->代码生成->基本运行时检查 为 默认值 就不会报本异常。具体原因正在研究中。。。
  2. 如果改为其他就有exception。
  3. exception有时是有道理的
  4. // step 1
  5. STRINGC2& STRINGC2::operator += (const char x)
  6. {
  7. // if (x == 0) return *this;
  8. char ptr[1]; // max is 1 digit
  9. ptr[0] = x;
  10. ptr[1] = '/0';
  11. *this += ptr; // off to step 2 and back
  12. return *this; // step 4 crash
  13. }
  14. 这个也会导致上述exception。
  15. 问题描述:
  16. Problem
  17. The following error message occurs when building on Test RealTIme environment with the cvisual7 TDP?
  18. Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted.
  19. Cause
  20. Stack pointer corruption is caused writing outside the allocated buffer in stack memeory.
  21. Solution
  22. This kind of error is detected by setting /RTC1 compiler option from menu Project -> Settings -> Configuration properties -> Build -> Compiler -> Compiler flags when using TDP cvisual7 in IBM® Rational® Test RealTime environment.. This enables stack frame run-time error checking. For example, the following code may cause the above error messge.
  23. #include <stdio.h>
  24. #include <string.h>
  25. #define BUFF_LEN 11 // 12 may fix the Run-Time Check Failure #2
  26. int rtc_option_test(char * pStr);
  27. int main()
  28. {
  29. char * myStr = "hello world";
  30. rtc_option_test(myStr);
  31. return 0;
  32. }
  33. int rtc_option_test(char * pStr)
  34. {
  35. char buff[BUFF_LEN];
  36. strcpy(buff, pStr); //cause Run-Time Check Failure #2 - Stack around
  37. //the variable 'buff' was corrupted.
  38. return 0;
  39. }

vs中 Stack around the variable 'XXX' was corrupted.的更多相关文章

  1. VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法

    问题 : 在用VS2008写一段代码,算法都没有问题,但是调试的时候发现出了main之后就报 Stack around the variable 'xxx' was corrupted 的错误,后来发 ...

  2. Run-Time Check Failure #2 Stack around the variable ‘xxx’ was corrupted

    在改别人代码时,运行报错: Run-Time Check Failure #2 Stack around the variable 'buffer' was corrupted 这表明你对某变量的赋值 ...

  3. vs中“Stack around the variable was corrupted”的解决方案

    把 project->配置属性->c/c++->代码生成->基本运行时检查 为 默认值 就不会报本异常.具体原因正在研究中... 如果改为其他就有exception. exce ...

  4. Stack around the variable 'szStr' was corrupted.

    错误:stack around the variable “XX” was corrupted.,中文翻译就是“在变量XX周围的堆栈已损坏”. 把 project->配置属性->c/c++ ...

  5. 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];   //此处如果索引值 ...

  6. Run-Time Check Failure #2 - Stack around the variable 's' was corrupted. 出现了 。

    程序中存在内存越界,注意数组大小和数据大小.

  7. stack around the variable “XX” was corrupted

    晚上花了几个小时fix了这个恼人的BUG!“在变量XX周围的堆栈已损坏” 在网上找到的解释是: 把“project->配置属性->c/c++->代码生成->基本运行时检查 设置 ...

  8. Run-Time Check Failure #2 - Stack around the variable 'ucPriKey' was corrupt

    Run-Time    Check    Failure    #2        一般是栈被破坏,你的代码可能有缓冲区溢出一类的问题. Run-Time Check Failure #2 - Sta ...

  9. 运行时错误:“stack around the variable…was corrupted”

    造冰箱的大熊猫@cnblogs 2018/11/1 引发问题的代码片段如下 WORD var; scanf ( "%d", &var ); 包含上述代码的程序,编译正常,运 ...

随机推荐

  1. IT兄弟连 HTML5教程 HTML5技术的应用现状及HTML5平台的兴起

    HTML5的优良特性很快被各种类型的网站利用,比如文件拖拽到网页上传功能,多数即使用HTML5提供的新属性就可以完成,来实现素材的免插件拖放.因此,HTML5技术实际上在国内已经获得了较广泛的应用与支 ...

  2. H5混合应用之X5内核

    一.X5内核介绍 X5内核是腾讯公司基于优秀开源 webkit 深度优化的浏览器渲染引擎,并且在2014年正式宣布开放给app开发者,所以现在可以在很多app上看到都是使用的X5内核实现Hybrid混 ...

  3. tensorflow slim代码使用

    此处纯粹作为个人学习使用,原文连接:https://www.jianshu.com/p/dc24e54aec81 这篇文章是借鉴很多博文的,作为一个关于slim库的总结 导入slim模块 import ...

  4. 邮件hMailServer +Foxmail 安装使用教程

    hMialServer是Windows下一款免费开源的邮件服务器软件,支持smtp.pop3.imap. 本文主要根据官方文档Quick-Start guide整理而成. 一.下载 下载地址:http ...

  5. elasticsearch 索引的使用(配合haystack)

    1,# 从仓库拉取镜像$ sudo docker image pull delron/elasticsearch-ik:2.4.6-1.02,下载elasticsearc-2.4.6目录拷贝到home ...

  6. java基础(20):Map、可变参数、Collections

    1. Map接口 1.1 Map接口概述 我们通过查看Map接口描述,发现Map接口下的集合与Collection接口下的集合,它们存储数据的形式不同,如下图. Collection中的集合,元素是孤 ...

  7. 致Python初学者的六点建议

    Python是最容易学习的编程语言之一,其语法近似英语.通常,初学者只会遇到一些小麻烦,如强制缩进.在函数中使用self等. 然而,当开始阅读.复制和编辑他人代码时,麻烦就接踵而至了. 这里,我将解释 ...

  8. MySQL学习——操作表里的数据

    MySQL学习——操作表里的数据 摘要:本文主要学习了使用DML语句操作表里数据的方法. 插入数据 语法 通过传入数据插入: insert into 表名 [(列名1, …, 列名n)] values ...

  9. export default和export的使用

    export default和export都是用来向外暴露成员 export default 向外暴露的成员可以使用任意的变量来接收,在一个模块中,export default只允许向外暴露一次,可以 ...

  10. Android8.1源码编译实践(Mac)

    第0步:版本选择 AOSP版本选择很重要,如果选错了,会造成编译失败等各种问题,编译AOSP对Xcode的版本是有要求的: 比如:AOSP6.0-7.0,要求Xcode的版本是8.3,然而在MacOS ...