电子学报 ›› 2014, Vol. 42 ›› Issue (9): 1744-1752.DOI: 10.3969/j.issn.0372-2112.2014.09.013

• 学术论文 • 上一篇    下一篇

基于区域内存模型的空指针引用缺陷检测

董玉坤1,2, 宫云战1, 金大海1   

  1. 1. 北京邮电大学网络与交换技术国家重点实验室, 北京 100876;
    2. 中国石油大学(华东)计算机与通信工程学院, 山东青岛 266580
  • 收稿日期:2014-01-23 修回日期:2014-04-24 出版日期:2014-09-25
    • 作者简介:
    • 董玉坤 男,1981年出生于山东省梁山县.中国石油大学(华东)计算机与通信工程学院讲师,主要研究领域为软件测试,程序静态分析. E-mail:dongyk@upc.edu.cn;宫云战 男,1962年生于山东省乳山市,北京邮电大学网络与交换技术国家重点实验室教授,博士生导师.研究方向为软件测试、可信计算等.;金大海 男,1974年出生于辽宁省沈阳市,北京邮电大学网络与交换技术国家重点实验室副教授.研究方向为软件测试、软件安全等.
    • 基金资助:
    • 国家自然科学基金 (No.91318301,No.61202080); 国家863高技术研究发展计划 (No.2012AA011201)

Null Pointer Dereference Defect Detected Based on Region-Based Memory Model

DONG Yu-kun1,2, GONG Yun-zhan1, JIN Da-hai1   

  1. 1. State Key Lab of Networking and Switching Tech, Beijing University of Posts and Telecommunications, Beijing 100876, China;
    2. College of Computer and Communication Engineering, China University of Petroleum, Qingdao, Shandong 266580, China
  • Received:2014-01-23 Revised:2014-04-24 Online:2014-09-25 Published:2014-09-25
    • Supported by:
    • National Natural Science Foundation of China (No.91318301, No.61202080); National High Technology Research and Development Program of China  (863 Program) (No.2012AA011201)

摘要:

为了实现对C程序中空指针引用的充分检测,本文提出了一种基于区域内存模型的空指针引用缺陷检测方法.首先,提出了基于区域的符号化三值逻辑(Region-based Symbolic Three-Valued Logic,RSTVL),RSTVL能够描述C程序运行时内存中数据结构的形态信息与变量的存储状态,以及可寻址表达式间的各种关系;其次,给出了基于抽象语法树与函数摘要识别被引用指针方法;最后,结合基于RSTVL的数据流分析结果,将对被引用指针的检测转换为对相应区域的检测,给出了空指针引用缺陷检测的方法,通过函数摘要实现过程间的空指针引用缺陷检测.对比实验结果表明,本文方法在保证一定检测准确率的前提下,能够极大的减少空指针引用缺陷的漏报.

关键词: 空指针引用, 内存模型, 静态分析, 函数摘要, 缺陷检测

Abstract:

In order to fully detect null pointer dereference for C procedures,this paper introduces a method based on region-based memory model.Firstly,region-based symbolic three-valued logic(RSTVL)is proposed,which can describe shape of data structures,all kinds of memory states and relations of addressable expressions.Then,an approach to fully recognizing pointer dereferences based on abstract syntax tree and procedure summary is introduced.Furthermore,this paper introduces a null pointer dereference detection method,which translates pointer dereference detection into region detection applying the result of data flow analysis based on RSTVL,and detects interprocedural null pointer dereference based on procedure summary.Experiment results show that compared with DTSC_STVL and Klocwork9,the proposed method could dramatically reduce null pointer dereference false negative on the precondition of guarantee the detection precision.

Key words: null pointer dereference, memory model, static analysis, function summary, defect detection

中图分类号: