With the rapid development of computer network and the popularity of open source mind,open source code,algorithm on the network and the function modules such as software development related information enrich the development of computer software,and some software developers reference to a certain extent reference related to open source code or open source framework on the network to reduce the development complexity and improve the development efficiency.However,the open source code on the network and the function module may exist many kinds of potential defects,such as:security hole,the back door code and Trojan virus,etc.,in the process of software development,if the software source code refers to the defective problem code,the software will likely introduce the defect code defects to the development of software.The software security issues,is the hotspot in research of safety,the key point of this thesis research.This paper introduces technologies of the source code homologous comparison and defect analysis of defect code.Based on this,we introduce the abstract syntax tree algorithm with pruning firstly,which improved the acurisy of the technology based on source code abstract syntax tree.The algorithm can efficiently find some plagiarism with changing underlying data of the source code,to a certain extent,improving the accuracy of source homologous comparison results.Secondly,the source code program dependency graph technology is applied to code defects detection technology,improved the algorithm of static stain analysis technique.This algorithm based on the PDG(Program Dependence Graph)structure of source code combine with the source code stain analysis to implement code for defect detection.This paper designs and implements a defect detection system based on source code homologous comparison.The system uses the homologous technologies based on text and abstract syntax tree,which is used to detect defects of the source code involved in the system with those source code in the code library using homologous comparison.The system supports defect code library management functions.Users can choose those defect source code according to their needs,add and delete the corresponding defect source code database.Through the experiment and test,on the one hand,the related technologies used in the process of system development was tested and verified the validity and accuracy.Second,also through the test,we proved that the system has carried on the overall performance of authentication,and obtained the good effect. |