计算机应用 ›› 2013, Vol. 33 ›› Issue (11): 3257-3261.

• 计算机软件技术 • 上一篇    下一篇

基于区间集的Cppcheck数组边界缺陷检测

张仕金,尚赵伟   

  1. 重庆大学 计算机学院,重庆 400030
  • 收稿日期:2013-05-14 修回日期:2013-07-17 出版日期:2013-11-01 发布日期:2013-12-04
  • 通讯作者: 张仕金
  • 作者简介:张仕金(1987-),男,安徽安庆人,硕士研究生,主要研究方向:软件缺陷、模式识别;尚赵伟(1968-),男,甘肃庆阳人,副教授, 主要研究方向:数字图像处理、软件缺陷、模式识别。
  • 基金资助:
    国家自然科学重点基金资助项目;国家自然科学基金资助项目;重庆市自然科学基金资助项目

Detection of array bound overflow by interval set based on Cppcheck

Zhang Shijin,SHANG Zhaowei   

  1. College of Computer Science and Technology, Chongqing University, Chongqing 400030, China
  • Received:2013-05-14 Revised:2013-07-17 Online:2013-12-04 Published:2013-11-01
  • Contact: Zhang Shijin

摘要: 针对开源软件Cppcheck误报率和漏报率过高,且不能检测出运行时程序缺陷等问题,基于Cppcheck程序,提出了抽象区间集算法,并将其应用于数组边界缺陷检测。在Cppcheck框架内,通过引入区间集概念,建立每个程序点变量和表达式的整型区间集和数组区间集,并由此定位出程序中的矛盾点,最终检测出程序缺陷。与Cppcheck相比较,所提算法的查准率提高18.5%,漏报率降低22.5%,误报率提高3.5%。实验结果表明,该方法能有效地检测出运行程序缺陷,并提高Cppcheck缺陷检测性能。

关键词: Cppcheck, 抽象区间集, 数组越界, 变量, 表达式

Abstract: The false positive rate and the false negative rate are too high for the open source software Cppcheck, and defects cannot be detected during program running. Interval set algorithm was put forward on the basis of Cppcheck program and was used for detecting array bound overflow. Shaping interval set and array interval set were established by introducing the concept of interval set. Each program variables and expressions interval values were constructed under the framework of Cppcheck to detect contradictions to locate defects. The precision rate increased by 18.5%, the false negative rate decreased by 22.5% and the false positive rate increased by 3.5% with the algorithm compared to Cppcheck. The experimental results show that the proposed algorithm can effectively detect the defects of running program and the detection performance gets improved.

Key words: Cppcheck, abstract interval set, array bound overflow, variable, expression

中图分类号: