首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 881 毫秒
1.
异常处理是程序开发的一个重要内容,C++语言为异常处理提供了更好的解决方案。分析了C++异常处理机制,重点强调了C++面向对象的异常处理,包括异常类、异常处理过程中对象的构造和析构、异常类的派生,这种分析有助于更好地在C++面向对象程序设计中正确使用异常处理技术,从而提高所开发系统的可靠性、健壮性。  相似文献   

2.
在程序的开发过程中,异常处理是必然要考虑的问题,本文对C++和Java两种语言的异常处理机制作了分析和比较,以便我们正确使用异常处理机制,增强程序的安全性、健壮性.  相似文献   

3.
为轻松获得程序的可能执行路径,进而实现程序变量的状态跟踪,提出了一种C/C++源代码控制流提取算法,通过该模型获取控制流切片,产生局部控制流图,将数据流异常检测与安全子集检测相结合,弥补了单独使用安全子集方法无法跟踪数据流的不足,增强代码安全隐患的挖掘能力.利用控制流图化简,排除部分不可达控制流信息,提高跟踪效率.通过对3个Linux内核源文件的检测,验证了该方法不仅可以检测出违反安全子集的代码安全隐患,同时对代码数据流异常检测提供支持,准确率达94.9%.  相似文献   

4.
目前,许多高性能的系统程序或应用程序,都是采用C/C++语言实现的,保障这些程序的安全是构造安全主机(或网络)环境的重要前提.面向C/C++代码的漏洞检测系统旨在程序运行之前发现源程序潜在的安全漏洞,降低出现安全漏洞的概率,对提高程序的安全性具有重要意义.首先介绍系统设计原理和设计流程;然后详细说明各模块的设计和实现过程;最后对实验结果进行分析.  相似文献   

5.
C++中用指针和引用传递函数参数剖析   总被引:3,自引:0,他引:3  
指针和引用的使用给 C++程序设计带来了灵活性和高效率。分析了 C++函数调用过程中指针和引用的使用机制 ,并结合实例说明了它们在程序设计中的应用。  相似文献   

6.
分析了C++程序中与继承相关的错误模式,这些错误会引起程序的数据流异常和行为异常.给出了几种常见错误模式的表现形式,结合实例详细分析了这些错误模式的产生原因及特点,重点讨论了容易产生数据流异常的基类与派生类之间的状态一致性问题,得到错误模式的分类.最终达到使用错误模式指导程序分析,检测面向对象程序中的潜在异常,维护系统的安全的目的.  相似文献   

7.
本文介绍了在应对真实世界的需要时积累的经验:C++标准模板库表现出与异常(exception)——C++语言核心内建的错误处理机制——良好的交互,这种交互是很有用的。本文探究了“异常安全”(exception safety)的含义,揭穿了一些关于“异常和泛型”的谎言,介绍了一些用于推断程序正确性的工具,并大致描述了一种验证异常安全性的自动测试过程。  相似文献   

8.
异常处理是程序开发的一个重要内容。通过分析C++语言中的异常处理机制,提出了利用面向对象的封装及动态联编特征来改进异常处理的方法,并以实例说明异常处理改进方法在面向对象C++语言中的具体实现。  相似文献   

9.
C/C++程序安全漏洞的分类与分析   总被引:6,自引:0,他引:6  
C/C++语言开发者追求的是语言的高效性、灵活性,为此不同程度上忽略了语言的安全性。目前很多机构比如NASA犤2犦等对不同语言中存在的安全问题提供了相关信息,文章在此基础上对C/C++程序中存在的安全漏洞进行分类并为每一小类作简要分析,为开发和确保安全的软件提供了指导  相似文献   

10.
张宇 《福建电脑》2012,28(5):146-147,152
异常处理是C++中的重要功能之一,为了检测和处理异常,C++语言不仅提供了一套完整的异常侦测和处理语句,还具有在堆栈展开期间为异常抛掷前构造的所有局部对象自动调用析构函数的能力。这使得程序中的错误的检测简单化,并提高程序处理错误的能力。本文将探讨C++中异常处理的基本思想以及编程中常用的异常处理方式。  相似文献   

11.
Exception handling mechanisms provide a structured way to deal with exceptional circumstances, making it easier to read and reason about programs. Exception handling, however, cannot avoid the problem that the transfer of control might leave the program in an inconsistent state—resources might leak, invariants might be violated, the program state might be changed. Since client code often needs to know how a program behaves in the presence of exceptions, the exception-safety classification distinguishes three different classes of safety guarantees; this classification is used, for example, during the review process in the Boost organization for standardized libraries in C++. Classifying the safety level of a procedure requires understanding program invariants and tracking program state at any given point in the code, which is error-prone when done by hand. Yet, no tool support is available to date. In this paper we present the first automated analysis for exception guarantees. Since the safety level of an arbitrary procedure is undecidable, the analysis conservatively approximates exception safety . The analysis is based on the theory of backward data-flow analysis and recognizes two of the three safety guarantees, the strong and the no-throw guarantee, and provides counterexamples otherwise. A prototype implementation is available.  相似文献   

12.
程序安全性验证是程序验证的重要部分。基于不变式生成,将程序的安全性验证转化为验证不变式集合是否蕴含表示安全性的逻辑公式。针对简化的C程序,结合验证工具Theorema,在Mathematica平台上实现一个对程序安全性进行自动验证的工具。实验结果表明,该验证工具能够自动验证只含数值变量的C程序。  相似文献   

13.
The software model checker Blast   总被引:2,自引:0,他引:2  
Blast is an automatic verification tool for checking temporal safety properties of C programs. Given a C program and a temporal safety property, Blast either statically proves that the program satisfies the safety property, or provides an execution path that exhibits a violation of the property (or, since the problem is undecidable, does not terminate). Blast constructs, explores, and refines abstractions of the program state space based on lazy predicate abstraction and interpolation-based predicate discovery. This paper gives an introduction to Blast and demonstrates, through two case studies, how it can be applied to program verification and test-case generation. In the first case study, we use Blast to statically prove memory safety for C programs. We use CCured, a type-based memory-safety analyzer, to annotate a program with run-time assertions that check for safe memory operations. Then, we use Blast to remove as many of the run-time checks as possible (by proving that these checks never fail), and to generate execution scenarios that violate the assertions for the remaining run-time checks. In our second case study, we use Blast to automatically generate test suites that guarantee full coverage with respect to a given predicate. Given a C program and a target predicate p, Blast determines the program locations q for which there exists a program execution that reaches q with p true, and automatically generates a set of test vectors that cause such executions. Our experiments show that Blast can provide automated, precise, and scalable analysis for C programs.  相似文献   

14.
阚双龙  黄志球  陈哲  徐丙凤 《软件学报》2014,25(11):2452-2472
提出使用事件自动机对 C 程序的安全属性进行规约,并给出了基于有界模型检测的形式化验证方法。事件自动机可以规约程序中基于事件的安全属性,且可以描述无限状态的安全属性。事件自动机将属性规约与C程序本身隔离,不会改变程序的结构。在事件自动机的基础上,提出了自动机可达树的概念。结合自动机可达树和有界模型检测技术,给出将事件自动机和C程序转化为可满足性模理论SMT(satisfiability modulo theory)模型的算法。最后,使用SMT求解器对生成的SMT模型求解,并根据求解结果给出反例路径分析算法。实例分析和实验结果表明,该方法可以有效验证软件系统中针对事件的属性规约。  相似文献   

15.
炸药件加工真空装夹安全性计算   总被引:1,自引:0,他引:1  
为解决真空装夹炸药件加工的安全问题,对炸药件真空装夹加工过程进行三维动力学分析.综合考虑重力、离心力和切削力等因素的影响,建立静态、转动态与切削态下真空装夹安全因数的计算方法和计算公式;采用C++编程,开发安全因数计算程序,实现炸药件加工真空装夹安全性的快速、自动计算.该方法能为工艺规划与工装设计、提前预防或减少炸药机...  相似文献   

16.
指针是C/C++语言中至关重要的概念,也是软件界备受争议和讨论的热点。提高指针的使用安全性对于软件的安全具有现实意义。指针是内存的直接管理者,指针做为函数参数在程序中传递导致内存不断拥有新的管理者,程序员弄清不同管理者的职责,进而操控指针控制内存,可提高程序的安全性。结合具体实例分析其有效性。  相似文献   

17.
对Liao等人身份鉴别方案的分析与改进   总被引:1,自引:0,他引:1       下载免费PDF全文
基于智能卡的身份鉴别是一种双因子鉴别,被广泛应用于鉴别远程用户的身份。2006年,Liao等人提出了一种基于智能卡的身份鉴别方案。在目前身份鉴别研究的基础上,分析指出了Liao等人方案存在的安全漏洞,并对方案作了改进,改进后的方案不仅保持了Liao等人方案的优点,而且极大地增强了系统的高效性、安全性和实用性。  相似文献   

18.
19.
唐珺 《计算机安全》2010,(12):63-65
程序设计中,异常是一个不可忽略的元素,因此,有效的异常处理是程序完善的重要标志。重点介绍了C#语言中的异常处理机制。主要包括异常的基础知识、异常处理机制、程序设计中的异常三个部分。异常基础知识部分,讲解了什么是异常,异常发生的情况及主要的异常类,使读者对程序异常有基本的认识。异常处理机制部分,从应用程序和理论两方面对C#语言中对异常的处理机制进行讲解,详细分析了三种异常处理语句。程序设计中的异常部分,通过一个简单的程序开发中的例子扩展异常机制在程序设计中的应用,拓宽软件开发人员的设计思路。  相似文献   

20.
Runtime monitors are a widely used approach to enforcing security policies. Truncation monitors are based on the idea of truncating an execution before a violation occurs. Thus, the range of security policies they can enforce is limited to safety properties. The use of an a priori static analysis of the target program is a possible way of extending the range of monitorable properties. This paper presents an approach to producing an in-lined truncation monitor, which draws upon the above intuition. Based on an a priori knowledge of the program behavior, this approach allows, in some cases, to enforce more than safety properties and is more powerful than a classical truncation mechanism. We provide and prove a theorem stating that a truncation enforcement mechanism considering only the set of possible executions of a specific program is strictly more powerful than a mechanism considering all the executions over an alphabet of actions.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号