WO2016085273A1 - Method for classifying alarm types in detecting source code error, computer program therefor, recording medium thereof - Google Patents

Method for classifying alarm types in detecting source code error, computer program therefor, recording medium thereof Download PDF

Info

Publication number
WO2016085273A1
WO2016085273A1 PCT/KR2015/012792 KR2015012792W WO2016085273A1 WO 2016085273 A1 WO2016085273 A1 WO 2016085273A1 KR 2015012792 W KR2015012792 W KR 2015012792W WO 2016085273 A1 WO2016085273 A1 WO 2016085273A1
Authority
WO
WIPO (PCT)
Prior art keywords
alarm
error detection
equation
source code
node
Prior art date
Application number
PCT/KR2015/012792
Other languages
French (fr)
Korean (ko)
Inventor
윤종원
진민식
Original Assignee
주식회사 파수닷컴
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from KR1020150028436A external-priority patent/KR101694783B1/en
Application filed by 주식회사 파수닷컴 filed Critical 주식회사 파수닷컴
Priority to US15/528,792 priority Critical patent/US10394687B2/en
Priority to JP2017528221A priority patent/JP6369736B2/en
Publication of WO2016085273A1 publication Critical patent/WO2016085273A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software

Definitions

  • the present invention relates to an alarm type classification method, a computer program, and a recording medium for detecting an error of a source code.
  • the present invention relates to an alarm by automatically classifying and analyzing various types of alarms related to source codes generated from a static analyzer.
  • the present invention relates to a method for classifying an alarm type, a computer program for the same, and a recording medium thereof, in error detection of source code to prevent waste of resources required for type classification.
  • Static analyzers are widely used to detect potential bugs or vulnerabilities in source code.
  • the static analyzer detects a predefined error for each checker by executing checkers for each function, and generates an alarm message for determining that the error is detected.
  • a process of classifying an alarm type may be performed for the purpose of analyzing the accuracy of the generated alarm.
  • the types of alarms can be classified and analyzed to further analyze or prepare for alarm types that have a high probability of false alarms.
  • This type of classification was conventionally performed by a developer's manual work. Classifiers are a waste of resources.
  • the present invention has been made in view of the above-mentioned conventional problems, and automatically classifies and analyzes various types of alarms related to source codes generated in a static analyzer, thereby preventing waste of resources required for alarm type classification. It is an object of the present invention to provide a method of classifying an alarm type, a computer program therefor, and a recording medium thereof, in detecting an error of source code.
  • the present invention for achieving the above object, it is executed in the alarm type classification device interlocked with the static analyzer, a method for classifying the error detection alarm generated by the static analyzer for each type, 1) detection of the error occurred Receiving alarm path information regarding an alarm and source code information targeted for an alarm, wherein the alarm path information is information on an execution path related to the generated error detection alarm among execution paths of source code; 2) converting the source code into an abstract syntax tree (AST); 3) removing an unnecessary subtree not associated with the error detection alert from the abstract syntax tree; 4) obtaining a feature vector for the abstract syntax tree from which unnecessary subtrees have been removed based on a set of preset feature patterns; And 5) clustering the obtained feature vectors in a preset manner to classify the error detection alerts corresponding to the feature vectors by type.
  • the method for classifying an alert type in error detection of the configured source code is disclosed.
  • the present invention in step 1), further receives alarm type information (alarm types) for the error detection alarm has occurred-the alarm type information corresponds to any type of the alarm type of the error detection alarm generated in advance Information on whether the feature pattern is set in advance for the alarm type of the error detection alert.
  • alarm type information alarm types
  • the alarm type information corresponds to any type of the alarm type of the error detection alarm generated in advance Information on whether the feature pattern is set in advance for the alarm type of the error detection alert.
  • the removal of the unnecessary subtree comprises a first policy for removing general syntax other than the syntax executed on the execution path associated with the error detection alert, and associated with the error detection alert.
  • the feature pattern set is configured in the form of a set of n feature patterns, and the feature pattern includes: conditional statement generation, loop statement generation, return statement generation, break or continuation (continue) statement occurrence, exit or assert method invocation, null expression, comparisons with a null value, null assignment assignments) occurrence, or statement generation that returns a null value.
  • the process of obtaining the feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed is 401) Defining a feature pattern set P configured in the form of a set of feature patterns p;
  • i th feature pattern (p i ) can be a single node or a subtree
  • V (P, d 1 ) ... V (P, d m ) is a feature vector obtained through Equation 4 for the child nodes d 1 , ..., d m ,
  • v (P, D) is an n-dimensional pattern satisfaction vector for any node D)
  • Equation 5 obtaining a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed.
  • the clustering is characterized by being performed by the K-means algorithm.
  • a computer program is stored in a medium in combination with hardware to execute an alarm type classification method in error detection of the source code.
  • a computer-readable recording medium having a computer program recorded thereon for executing an alarm type classification method in a computer in detecting an error of the source code is disclosed.
  • the present invention in the error detection of the source code using the static analyzer, there is an advantage that it is possible to classify and analyze the occurrence type of the alarm, and to further analyze or prepare for the alarm type having a high probability of false alarm. .
  • the type of alarm classification can be executed through an automatic process without performing by a developer's manual work, there is an advantage in that a waste of resources required for alarm type classification can be prevented.
  • FIG. 1 is a conceptual diagram illustrating an alarm type classification method in error detection of source code according to an embodiment of the present invention.
  • first and second may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another.
  • the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component.
  • FIG. 1 is a conceptual diagram illustrating an alarm type classification method in error detection of source code according to an embodiment of the present invention.
  • the present invention is executed in an alarm type classification apparatus that interworks with a static analyzer, and is a method for classifying error detection alarms generated by a static analyzer by type.
  • the alarm type classification device may be understood as a computing means for executing the alarm type classification method or a functional module thereof.
  • the alarm type classification device may be implemented in the static analyzer in the form of an interlocking module or in the form of an internal module.
  • the alarm type classification apparatus of this embodiment is interlocked with various known static analyzers.
  • the static analyzer has been known a variety of commercial products of the grammar-based (Syntactic) analysis or semantic analysis method, the detailed description thereof will be omitted.
  • the alarm type classification apparatus receives alarm path information regarding the generated error detection alarm and source code information that is the target of the alarm.
  • the input may be based on an input request of an alarm type classification device or a setting of a static analyzer, and a static analyzer linked with the alarm type classification device may provide the respective information to the alarm type classification device, or in another example,
  • the file in which each information is recorded may be made by a user inputting the alarm type classification device to be readable.
  • the alarm path information is information about an execution path related to the generated error detection alarm among execution paths of source code.
  • the static analyzer detects whether an analysis target source code is error based on a predetermined criterion for each checker by executing checkers for each function, and generates a specific alarm for determining that an error is detected.
  • the alarm is made by outputting a specific alarm message preset to the checker with respect to the detected error.
  • Each alert message is basically dependent on a specific checker, and generally does not reflect the nature or form of the source code, or features on the execution path.
  • step S1 the alarm type classification apparatus is further received with alarm type information regarding the error detection alarm that has occurred.
  • One 'alarm type' has the same alarm message. For example, one checker generates one alert message and can be understood to define one 'alarm type'.
  • the 'alarm type' may include 'general null dereference', 'dereferencing of an unchecked null value', and 'dereferencing of a returned null value', and the like, and various alarm types may be set.
  • a feature pattern set to be described below is defined for each alarm type.
  • step S2 the alarm type classification apparatus converts the source code into an abstract syntax tree (AST).
  • AST abstract syntax tree
  • An abstract syntax tree is a tree of abstract syntax structures in source code written in a programming language, where each node represents a structure generated from the source code. Detailed concepts of the abstract syntax tree may be understood through a number of known materials, and thus detailed descriptions thereof will be omitted.
  • step S3 the alert type classification apparatus removes an unnecessary subtree not associated with the error detection alert from the abstract syntax tree.
  • Elimination of unnecessary subtrees can be accomplished by conventional rule-based techniques.
  • the removal of the unnecessary subtree may include a first policy for removing general syntax other than the syntax executed on the execution path associated with the error detection alert, and a branch executed on the execution path associated with the error detection alert.
  • step S4 the alert type classification apparatus obtains the feature vector for the abstract syntax tree from which the unnecessary subtree has been removed based on the preset feature pattern set.
  • the abstract syntax tree (AST) obtained from the source code is too large and complex to use as input data for classification of alert types through clustering.
  • the clustering processing time is reduced and the resource required for this is obtained.
  • the feature pattern set is configured in the form of a set of n feature patterns preset, wherein the feature pattern is a condition statement generation, loop statement generation, return statement generation, break or continue statement generation, An exit or assert method invocation, a null expression, a comparison with a null value, a null assignments, a null value It can be any one of the occurrences of statements that return. This is summarized as follows.
  • the feature pattern set i.e., the set of n feature patterns, is preset for each alert type of the error detection alert.
  • the alarm type classification is made within the scope of one specific alarm type.
  • step S4 a process of obtaining a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed is performed as follows.
  • the alarm type classification apparatus defines a feature pattern set P configured in the form of a set of n feature patterns p, as shown in Equation 1 below.
  • the alarm type classification apparatus defines an n-dimensional pattern satisfaction vector v (P, d) for any node d on the abstract syntax tree, as shown in Equation 2 below.
  • i th feature pattern (p i ) can be a single node or a subtree
  • the apparatus for classifying an alert type defines a feature vector V (P, D) for any node D on the abstract syntax tree, as shown in Equation 4 below.
  • V (P, d 1 ) ... V (P, d m ) is a feature vector obtained through Equation 4 for the child nodes d 1 , ..., d m ,
  • v (P, D) is an n-dimensional pattern satisfaction vector for any node D)
  • the apparatus for classifying an alert type obtains a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed using Equation 5 below.
  • Equation 5 may be understood as an arbitrary node D of Equation 4 obtained by inputting a root node R of the abstract syntax tree from which an unnecessary subtree is removed.
  • the alarm type classification apparatus may cluster the obtained feature vector V (R) in a preset manner to classify the error detection alert corresponding to the feature vector by type.
  • a known vector or data clustering technique may be used.
  • a known hierarchical clustering technique or a non-hierarchical clustering technique may be used.
  • K-means is a method of finding the centroid of a cluster by minimizing the Euclidean distance between the data (or vector) and the center of the cluster to which the data (or vector) belongs.
  • the K-means algorithm has a simple structure and generally has a fast convergence property, it can be applied as a preferable example in this embodiment.
  • feature vectors with high similarity may be classified into the same type, and as a result, respective error detection alerts corresponding to feature vectors classified into the same type may also be classified into the same type of alerts. For example, detailed conditions of similarity that may be classified into the same type may be preset in the alarm type classification device.
  • This classification of alert types provides developers with several advantages in the analysis of error detection alerts.
  • the developer first analyzes the error detection alarm first. May first determine whether or not a false alarm is present.
  • Embodiments of the present invention include a program for performing various computer-implemented operations and a computer readable medium recording the same.
  • the computer readable medium may include program instructions, data files, data structures, etc. alone or in combination.
  • the media may be those specially designed and constructed for the purposes of the present invention, or they may be of the kind well-known and available to those having skill in the computer software arts.
  • Examples of computer readable recording media include magnetic media such as hard disks, floppy disks and magnetic tape, optical recording media such as CD-ROM, DVD, USB drives, magnetic-optical media such as floppy disks, and ROM, RAM, Hardware devices specifically configured to store and execute program instructions, such as flash memory, are included.
  • the medium may be a transmission medium such as an optical or metal wire, a waveguide, or the like including a carrier wave for transmitting a signal specifying a program command, a data structure, or the like.
  • program instructions include not only machine code generated by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like.

Abstract

The present invention relates to a method for classifying alarm types in detecting a source code error, a computer program therefor, and a recording medium thereof. The method, according to one aspect of the present invention, is executed on an alarm type classifying device connected to a static analyzer and is for classifying, by type, error detection alarms occurring on the static analyzer, and disclosed is a method for classifying alarm types in detecting a source code error, the method comprising the steps of: 1) receiving input on information on error detection alarms that occurred, the information being information on alarm path and information on the source code which is the subject of the alarm, wherein the information on alarm path is information on the execution path, among execution paths of the source code, related to the error detection alarms that occurred; 2) converting the source code into an abstract syntax tree (AST); 3) removing, from the AST, unnecessary subtrees that are not related to the error detection alarms; 4) on the basis of a pre-set feature pattern set, obtaining a feature vector on the AST having unnecessary subtrees removed therefrom; and 5) classifying, by type, the error detection alarms corresponding to the feature vector by clustering the obtained feature vector by means of a pre-set method.

Description

소스 코드의 오류 검출에 있어서 경보 유형 분류 방법, 이를 위한 컴퓨터 프로그램, 그 기록매체Method of classifying alarm type in error detection of source code, computer program for it, recording medium thereof
본 발명은 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법, 이를 위한 컴퓨터 프로그램, 그 기록매체에 관한 것으로서, 정적분석기에서 발생하는 소스 코드에 관한 다양한 경보의 발생 유형을 자동적으로 분류하고 분석하여, 경보 유형 분류에 소요되는 리소스의 낭비를 방지할 수 있도록 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법, 이를 위한 컴퓨터 프로그램, 그 기록매체에 관한 것이다. The present invention relates to an alarm type classification method, a computer program, and a recording medium for detecting an error of a source code. The present invention relates to an alarm by automatically classifying and analyzing various types of alarms related to source codes generated from a static analyzer. The present invention relates to a method for classifying an alarm type, a computer program for the same, and a recording medium thereof, in error detection of source code to prevent waste of resources required for type classification.
소스 코드에 존재하는 잠재적인 오류(bug)나 취약점을 발견하기 위해 정적분석기가 널리 사용된다. 정적분석기는 각 기능별 체커의 실행에 의해 각 체커별로 미리 정의된 오류를 검출하고, 오류가 검출된 것으로 판단하면 이에 대한 경보(alarm) 메시지를 발생한다. Static analyzers are widely used to detect potential bugs or vulnerabilities in source code. The static analyzer detects a predefined error for each checker by executing checkers for each function, and generates an alarm message for determining that the error is detected.
정적분석기의 경보가 발생하는 경우, 발생한 경보의 정확도 분석 등의 목적을 위해 경보 유형을 분류하는 과정이 이뤄질 수 있다. When an alarm of a static analyzer is generated, a process of classifying an alarm type may be performed for the purpose of analyzing the accuracy of the generated alarm.
예를 들어, 정적분석기의 분석 과정에서 오류 여부의 판단이 항상 정확하게 이뤄지지 못할 수가 있으며, 이로 인해 분석 대상 소스 코드에 오류가 존재하지 않음에도 불구하고 오류가 존재하는 것으로 잘못 판단하여 오경보(false alarm)를 발생할 수 있다. For example, in the analysis process of the static analyzer, it may not always be possible to accurately determine whether an error exists. As a result, a false alarm may be falsely determined as an error exists even though an error does not exist in the target source code. May occur.
이러한 경우, 경보의 발생 유형을 분류하고 분석하여, 오경보의 가능성이 높은 경보 유형에 대하여 추가적인 분석이나 대비를 할 수 있는데, 이러한 유형 분류 작업이 기존에는 개발자의 수작업에 의해 이뤄지는 것이 일반적이었으므로, 이러한 종래의 경보 유형 분류 작업은 리소스의 낭비 요인이 되었다.In this case, the types of alarms can be classified and analyzed to further analyze or prepare for alarm types that have a high probability of false alarms. This type of classification was conventionally performed by a developer's manual work. Classifiers are a waste of resources.
본 발명은 상기와 같은 종래의 문제점을 감안하여 안출한 것으로서, 정적분석기에서 발생하는 소스 코드에 관한 다양한 경보의 발생 유형을 자동적으로 분류하고 분석하여, 경보 유형 분류에 소요되는 리소스의 낭비를 방지할 수 있도록 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법, 이를 위한 컴퓨터 프로그램, 그 기록매체를 제공하는 것을 그 목적으로 한다. The present invention has been made in view of the above-mentioned conventional problems, and automatically classifies and analyzes various types of alarms related to source codes generated in a static analyzer, thereby preventing waste of resources required for alarm type classification. It is an object of the present invention to provide a method of classifying an alarm type, a computer program therefor, and a recording medium thereof, in detecting an error of source code.
상기와 같은 목적을 달성하기 위한 본 발명의 일측면에 따르면, 정적분석기와 연동하는 경보 유형 분류 장치에서 실행되며, 정적분석기에서 발생한 오류 검출 경보를 유형별로 분류하기 위한 방법으로서, 1) 발생한 오류 검출 경보에 관한 경보 경로(alarm path) 정보 및 경보의 대상이 된 소스 코드 정보를 입력받는 단계- 상기 경보 경로 정보는 소스 코드의 실행 경로 중에서 상기 발생한 오류 검출 경보와 관련된 실행 경로에 관한 정보임-; 2) 상기 소스 코드를 추상 구문 트리(abstract syntax tree, AST)로 변환하는 단계; 3) 상기 추상 구문 트리에서 상기 오류 검출 경보와 관련되지 않은 불요 서브트리(unnecessary subtree)를 제거하는 단계; 4) 미리 설정된 피쳐 패턴 세트에 근거하여, 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터를 수득하는 단계; 및 5) 수득된 상기 피쳐 벡터를 미리 설정된 방식으로 클러스터링하여 상기 피쳐 벡터에 대응하는 오류 검출 경보를 유형별로 분류하는 단계;를 포함하여 구성된 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법이 개시된다. According to an aspect of the present invention for achieving the above object, it is executed in the alarm type classification device interlocked with the static analyzer, a method for classifying the error detection alarm generated by the static analyzer for each type, 1) detection of the error occurred Receiving alarm path information regarding an alarm and source code information targeted for an alarm, wherein the alarm path information is information on an execution path related to the generated error detection alarm among execution paths of source code; 2) converting the source code into an abstract syntax tree (AST); 3) removing an unnecessary subtree not associated with the error detection alert from the abstract syntax tree; 4) obtaining a feature vector for the abstract syntax tree from which unnecessary subtrees have been removed based on a set of preset feature patterns; And 5) clustering the obtained feature vectors in a preset manner to classify the error detection alerts corresponding to the feature vectors by type. The method for classifying an alert type in error detection of the configured source code is disclosed.
바람직하게, 본 발명은, 상기 1) 단계에서, 발생한 오류 검출 경보에 관한 경보 타입(alarm types) 정보를 더 입력받으며- 상기 경보 타입 정보는 발생한 오류 검출 경보가 미리 설정된 경보 타입 중에서 어느 타입에 해당하는지에 관한 정보임-, 상기 4) 단계에서, 상기 피쳐 패턴 세트는 상기 오류 검출 경보의 경보 타입에 대하여 미리 설정된 것임을 특징으로 한다. Preferably, the present invention, in step 1), further receives alarm type information (alarm types) for the error detection alarm has occurred-the alarm type information corresponds to any type of the alarm type of the error detection alarm generated in advance Information on whether the feature pattern is set in advance for the alarm type of the error detection alert.
바람직하게, 상기 3) 단계에서, 상기 불요 서브트리(unnecessary subtree)의 제거는, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 구문을 제외한 다른 일반 구문을 제거하는 제1 정책과, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 분기문이 아닌 다른 분기문을 제거하는 제2 정책과- 단, 오류 검출 경보와 관련된 실행 경로는 분기문의 조건 판별 결과를 포함함-, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 반복문이 아닌 다른 반복문을 제거하는 제3 정책과, 오류 검출 경보와 관련된 실행 경로 상에서 호출된 함수 및 상기 함수의 실행 경로를 상기 함수를 호출하는 노드의 서브트리로 포함하는 제4 정책과, 오류 검출 경보와 관련된 실행 경로와 관계 없는 선언문을 제거하는 제5 정책 중의 적어도 어느 하나의 정책에 근거하여 이뤄지는 것을 특징으로 한다. Preferably, in step 3), the removal of the unnecessary subtree comprises a first policy for removing general syntax other than the syntax executed on the execution path associated with the error detection alert, and associated with the error detection alert. A second policy for removing branch statements other than those executed on the execution path, provided that the execution path associated with the error detection alert includes the result of condition determination of the branch statement; A third policy for removing loops other than loops, a fourth policy including a function called on an execution path associated with an error detection alert, and an execution path of the function as a subtree of a node invoking the function, and error detection Is based on at least one of the fifth policies for removing declarations that are not relevant to the path of execution associated with the alert. It features.
바람직하게, 상기 4) 단계에서, 상기 피쳐 패턴 세트는, 미리 설정된 n 개의 피쳐 패턴의 세트 형태로 구성되며, 상기 피쳐 패턴은, 조건문 발생, 루프문 발생, 리턴문 발생, 브레이크(break) 또는 컨티뉴(continue)문 발생, 엑시트(exit) 또는 어서트(assert) 메소드 호출(method invocation) 발생, 널 표현(null expression) 발생, 널 값과의 비교(comparisons with a null value) 발생, 널 할당(null assignments) 발생, 널 값을 리턴하는 문(statements)의 발생 중의 어느 하나인 것을 특징으로 한다. Preferably, in step 4), the feature pattern set is configured in the form of a set of n feature patterns, and the feature pattern includes: conditional statement generation, loop statement generation, return statement generation, break or continuation (continue) statement occurrence, exit or assert method invocation, null expression, comparisons with a null value, null assignment assignments) occurrence, or statement generation that returns a null value.
바람직하게, 상기 4) 단계에서, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))의 수득 과정은, 401) 하기 수학식1과 같이, n 개의 피쳐 패턴(p)의 세트 형태로 구성된 피쳐 패턴 세트(P)를 정의하는 단계; Preferably, in step 4), the process of obtaining the feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed is 401) Defining a feature pattern set P configured in the form of a set of feature patterns p;
[수학식1][Equation 1]
P = {p1, p2, ..., pn}P = {p 1 , p 2 , ..., p n }
402) 하기 수학식2와 같이, 추상 구문 트리 상의 임의의 노드 d에 대한 n 차원의 패턴 만족 벡터(v(P,d))를 정의하는 단계; 402) defining an n-dimensional pattern satisfaction vector v (P, d) for any node d on the abstract syntax tree as shown in Equation 2 below;
[수학식2][Equation 2]
Figure PCTKR2015012792-appb-I000001
Figure PCTKR2015012792-appb-I000001
(단, S(d,pi)는 임의의 노드 d 또는 노드 d를 루트로 하는 서브트리가 i 번째 피쳐 패턴(pi)에 매칭되는지 여부를 나타내는 인자로서, 하기 수학식3과 같이 정의되며, i 번째 피쳐 패턴(pi)은 단일 노드 또는 서브트리일 수 있음(Where S (d, p i ) is a factor indicating whether an arbitrary node d or a subtree rooted at node d matches the i th feature pattern p i , and is defined as in Equation 3 below. , i th feature pattern (p i ) can be a single node or a subtree
[수학식3][Equation 3]
Figure PCTKR2015012792-appb-I000002
)
Figure PCTKR2015012792-appb-I000002
)
403) 하기 수학식4와 같이, 추상 구문 트리 상의 임의의 노드 D에 대한 피쳐 벡터(V(P,D))를 정의하는 단계; 및 403) defining a feature vector V (P, D) for any node D on the abstract syntax tree, as shown in Equation 4 below; And
[수학식4][Equation 4]
Figure PCTKR2015012792-appb-I000003
Figure PCTKR2015012792-appb-I000003
(단, d1,...,dm은 임의의 노드 D의 자식 노드들이며, (Where d 1 , ..., d m are children of any node D,
V(P,d1)...V(P,dm) 는 자식 노드 d1,...,dm에 대하여 상기 수학식4를 통해 구한 피쳐 벡터이며, V (P, d 1 ) ... V (P, d m ) is a feature vector obtained through Equation 4 for the child nodes d 1 , ..., d m ,
v(P,D)는 임의의 노드 D에 대한 n 차원의 패턴 만족 벡터임)v (P, D) is an n-dimensional pattern satisfaction vector for any node D)
404) 하기 수학식5를 이용하여, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))를 수득하는 단계;를 포함하여 구성된 것을 특징으로 한다. 404) using Equation 5 below, obtaining a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed.
[수학식5] [Equation 5]
Figure PCTKR2015012792-appb-I000004
Figure PCTKR2015012792-appb-I000004
(단, R은 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리의 루트 노드로서 상기 수학식4의 노드 D에 대응함)(Where R is the root node of the abstract syntax tree from which the unnecessary subtree is removed and corresponds to node D of Equation 4)
바람직하게, 상기 5) 단계에서, 상기 클러스터링은 K-means 알고리즘에 의해 실행되는 것을 특징으로 한다. Preferably, in step 5), the clustering is characterized by being performed by the K-means algorithm.
본 발명의 또 다른 일측면에 따르면, 하드웨어와 결합되어 상기 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 실행시키기 위하여 매체에 저장된 컴퓨터 프로그램이 개시된다. According to yet another aspect of the present invention, a computer program is stored in a medium in combination with hardware to execute an alarm type classification method in error detection of the source code.
본 발명의 또 다른 일측면에 따르면, 상기 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 컴퓨터에서 실행하기 위한 컴퓨터 프로그램이 기록된, 컴퓨터로 판독 가능한 기록 매체가 개시된다. According to yet another aspect of the present invention, a computer-readable recording medium having a computer program recorded thereon for executing an alarm type classification method in a computer in detecting an error of the source code is disclosed.
이와 같은 본 발명에 따르면, 정적분석기를 이용한 소스 코드의 오류 검출에 있어서, 경보의 발생 유형을 분류하고 분석하여, 오경보의 가능성이 높은 경보 유형에 대하여 추가적인 분석이나 대비를 할 수 있도록 한다는 장점이 있다. According to the present invention, in the error detection of the source code using the static analyzer, there is an advantage that it is possible to classify and analyze the occurrence type of the alarm, and to further analyze or prepare for the alarm type having a high probability of false alarm. .
특히, 본 발명에 따르면, 경보의 유형 분류 작업을 개발자의 수작업에 의해 수행하지 않고 자동적인 프로세스를 통해 실행할 수 있으므로, 경보 유형 분류에 소요되는 리소스의 낭비를 방지할 수 있다는 장점이 있다.In particular, according to the present invention, since the type of alarm classification can be executed through an automatic process without performing by a developer's manual work, there is an advantage in that a waste of resources required for alarm type classification can be prevented.
도 1은 본 발명의 일실시예에 따른 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 설명하기 위한 개념도이다.1 is a conceptual diagram illustrating an alarm type classification method in error detection of source code according to an embodiment of the present invention.
본 발명은 그 기술적 사상 또는 주요한 특징으로부터 벗어남이 없이 다른 여러가지 형태로 실시될 수 있다. 따라서, 본 발명의 실시예들은 모든 점에서 단순한 예시에 지나지 않으며 한정적으로 해석되어서는 안 된다.The present invention can be embodied in many other forms without departing from the spirit or main features thereof. Therefore, the embodiments of the present invention are merely examples in all respects and should not be interpreted limitedly.
제1, 제2 등의 용어는 다양한 구성요소들을 설명하는 데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 및/또는 이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다.Terms such as first and second may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component. The term and / or includes a combination of a plurality of related items or any item of a plurality of related items.
어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.When a component is referred to as being "connected" or "connected" to another component, it may be directly connected to or connected to that other component, but it may be understood that other components may be present in between. Should be. On the other hand, when a component is said to be "directly connected" or "directly connected" to another component, it should be understood that there is no other component in between.
본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "구비하다", "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting of the present invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. In this application, the terms "comprise", "comprise", "have", and the like are intended to indicate that there is a feature, number, step, operation, component, part, or combination thereof described in the specification. Or other features or numbers, steps, operations, components, parts or combinations thereof in any way should not be excluded in advance.
다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art. Terms such as those defined in the commonly used dictionaries should be construed as having meanings consistent with the meanings in the context of the related art, and are not construed in ideal or excessively formal meanings unless expressly defined in this application. Do not.
이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 실시예를 상세히 설명하되, 도면 부호에 관계없이 동일하거나 대응하는 구성 요소는 동일한 참조 번호를 부여하고 이에 대한 중복되는 설명은 생략하기로 한다. 본 발명을 설명함에 있어서 관련된 공지 기술에 대한 구체적인 설명이 본 발명의 요지를 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings, and the same or corresponding components will be denoted by the same reference numerals regardless of the reference numerals and redundant description thereof will be omitted. In the following description of the present invention, if it is determined that the detailed description of the related known technology may obscure the gist of the present invention, the detailed description thereof will be omitted.
도 1은 본 발명의 일실시예에 따른 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 설명하기 위한 개념도이다. 1 is a conceptual diagram illustrating an alarm type classification method in error detection of source code according to an embodiment of the present invention.
본 실시예의 발명은, 정적분석기와 연동하는 경보 유형 분류 장치에서 실행되며, 정적분석기에서 발생한 오류 검출 경보를 유형별로 분류하기 위한 방법이다. The present invention is executed in an alarm type classification apparatus that interworks with a static analyzer, and is a method for classifying error detection alarms generated by a static analyzer by type.
일예로, 상기 경보 유형 분류 장치는 경보 유형 분류 방법을 실행하는 컴퓨팅 수단 또는 그 기능 모듈로 이해될 수 있으며, 정적분석기에 연동 모듈 형태로 구현되거나, 내부 모듈 형태로 구현될 수 있다. For example, the alarm type classification device may be understood as a computing means for executing the alarm type classification method or a functional module thereof. The alarm type classification device may be implemented in the static analyzer in the form of an interlocking module or in the form of an internal module.
본 실시예의 경보 유형 분류 장치는 공지의 다양한 정적분석기와 연동한다. 일예로, 정적분석기는 문법기반(Syntactic) 분석 또는 의미기반(Semantic) 분석 방식의 다양한 상용 제품들이 공지된 바 있으며, 그 상세한 설명은 생략한다. The alarm type classification apparatus of this embodiment is interlocked with various known static analyzers. For example, the static analyzer has been known a variety of commercial products of the grammar-based (Syntactic) analysis or semantic analysis method, the detailed description thereof will be omitted.
S1 단계에서, 경보 유형 분류 장치는, 발생한 오류 검출 경보에 관한 경보 경로(alarm path) 정보 및 경보의 대상이 된 소스 코드 정보를 입력받는다. 일예로, 상기 입력은 경보 유형 분류 장치의 입력 요청 또는 정적분석기의 설정에 근거하여, 경보 유형 분류 장치와 연동하는 정적분석기가 경보 유형 분류 장치로 상기 각 정보를 입력 제공하거나, 다른예로, 상기 각 정보가 기록된 파일을 사용자가 경보 유형 분류 장치가 독출 가능하도록 입력하는 방식으로 이뤄질 수 있다. In step S1, the alarm type classification apparatus receives alarm path information regarding the generated error detection alarm and source code information that is the target of the alarm. For example, the input may be based on an input request of an alarm type classification device or a setting of a static analyzer, and a static analyzer linked with the alarm type classification device may provide the respective information to the alarm type classification device, or in another example, The file in which each information is recorded may be made by a user inputting the alarm type classification device to be readable.
상기 경보 경로 정보는 소스 코드의 실행 경로 중에서 상기 발생한 오류 검출 경보와 관련된 실행 경로에 관한 정보이다. The alarm path information is information about an execution path related to the generated error detection alarm among execution paths of source code.
정적분석기는 각 기능별 체커의 실행에 의해 각 체커별로 미리 정의된 기준에 근거하여 분석 대상 소스 코드의 오류 여부를 검출하고, 오류가 검출된 것으로 판단하면 이에 대한 특정한 경보(alarm)를 발생한다. The static analyzer detects whether an analysis target source code is error based on a predetermined criterion for each checker by executing checkers for each function, and generates a specific alarm for determining that an error is detected.
이때, 상기 경보는 검출된 오류에 대하여 체커에 미리 설정된 특정 경보 메시지를 출력하는 방식으로 이뤄진다. 각 경보 메시지는 기본적으로 특정 체커에 종속되어 있으며, 일반적으로 소스 코드의 특징이나 형태, 혹은 실행 경로 상의 특징을 반영하고 있지는 않다. At this time, the alarm is made by outputting a specific alarm message preset to the checker with respect to the detected error. Each alert message is basically dependent on a specific checker, and generally does not reflect the nature or form of the source code, or features on the execution path.
바람직하게, S1 단계에서, 경보 유형 분류 장치는, 발생한 오류 검출 경보에 관한 경보 타입(alarm types) 정보를 더 입력받는다. Preferably, in step S1, the alarm type classification apparatus is further received with alarm type information regarding the error detection alarm that has occurred.
하나의 '경보 타입'은 동일한 경보 메시지를 가진다. 일예로, 하나의 체커는 하나의 경보 메시지를 발생시키며, 하나의 '경보 타입'을 정의하는 것으로 이해될 수 있다. One 'alarm type' has the same alarm message. For example, one checker generates one alert message and can be understood to define one 'alarm type'.
일예로, 상기 '경보 타입'은 'general null dereference', 'dereferencing of an unchecked null value' 및 'dereferencing of a returned null value' 등을 그 예로 들 수 있으며, 이외에도 다양한 경보 타입이 설정될 수 있다.For example, the 'alarm type' may include 'general null dereference', 'dereferencing of an unchecked null value', and 'dereferencing of a returned null value', and the like, and various alarm types may be set.
일예로, 상기 경보 타입(alarm types) 별로 후술하는 피쳐 패턴 세트가 정의된다. For example, a feature pattern set to be described below is defined for each alarm type.
S2 단계에서, 경보 유형 분류 장치는, 상기 소스 코드를 추상 구문 트리(abstract syntax tree, AST)로 변환한다. In step S2, the alarm type classification apparatus converts the source code into an abstract syntax tree (AST).
추상 구문 트리(abstract syntax tree, AST)는 프로그래밍 언어로 작성된 소스 코드의 추상 구문 구조의 트리로서, 이 트리의 각 노드는 소스 코드에서 발생되는 구조체를 나타낸다. 추상 구문 트리의 상세한 개념은 다수의 공지 자료를 통해 이해될 수 있으므로 상세 설명은 생략한다. An abstract syntax tree (AST) is a tree of abstract syntax structures in source code written in a programming language, where each node represents a structure generated from the source code. Detailed concepts of the abstract syntax tree may be understood through a number of known materials, and thus detailed descriptions thereof will be omitted.
S3 단계에서, 경보 유형 분류 장치는, 상기 추상 구문 트리에서 상기 오류 검출 경보와 관련되지 않은 불요 서브트리(unnecessary subtree)를 제거한다. In step S3, the alert type classification apparatus removes an unnecessary subtree not associated with the error detection alert from the abstract syntax tree.
불요 서브트리(unnecessary subtree)의 제거는 통상의 규칙 기반 기법에 의해 이뤄질 수 있다. Elimination of unnecessary subtrees can be accomplished by conventional rule-based techniques.
일예로, 상기 불요 서브트리(unnecessary subtree)의 제거는, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 구문을 제외한 다른 일반 구문을 제거하는 제1 정책과, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 분기문이 아닌 다른 분기문을 제거하는 제2 정책과- 단, 오류 검출 경보와 관련된 실행 경로는 분기문의 조건 판별 결과를 포함함-, 오류 검출 경보와 관련된 실행 경로 상에서 실행된 반복문이 아닌 다른 반복문을 제거하는 제3 정책과, 오류 검출 경보와 관련된 실행 경로 상에서 호출된 함수 및 상기 함수의 실행 경로를 상기 함수를 호출하는 노드의 서브트리로 포함하는 제4 정책과, 오류 검출 경보와 관련된 실행 경로와 관계 없는 선언문을 제거하는 제5 정책 중의 적어도 어느 하나의 정책에 근거하여 이뤄진다. For example, the removal of the unnecessary subtree may include a first policy for removing general syntax other than the syntax executed on the execution path associated with the error detection alert, and a branch executed on the execution path associated with the error detection alert. A second policy for removing branch statements other than the statement, provided that the execution path associated with the error detection alert includes the result of condition determination of the branch statement; A third policy to remove, a fourth policy including a function called on an execution path associated with an error detection alert and an execution path of the function as a subtree of a node invoking the function, an execution path associated with an error detection alert, and It is based on at least one of the fifth policies for removing extraneous statements.
S4 단계에서, 경보 유형 분류 장치는, 미리 설정된 피쳐 패턴 세트에 근거하여, 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터를 수득한다. In step S4, the alert type classification apparatus obtains the feature vector for the abstract syntax tree from which the unnecessary subtree has been removed based on the preset feature pattern set.
소스 코드로부터 구해진 추상 구문 트리(abstract syntax tree, AST)는 클러스터링을 통한 경보 유형 분류를 위해 그대로 입력 데이터로 활용 하기에는 너무 크고 복잡한 구조를 갖는다. 본 실시예와 같이 소스 코드로부터 구해진 추상 구문 트리에 대하여 피쳐 벡터를 수득하고 이를 이용하여 클러스터링을 하게 되면, 클러스터링 처리 시간을 줄이고 이에 필요한 리소스 소요를 줄이는 장점을 얻게 된다. The abstract syntax tree (AST) obtained from the source code is too large and complex to use as input data for classification of alert types through clustering. When the feature vector is obtained and clustered using the abstract syntax tree obtained from the source code as in this embodiment, the clustering processing time is reduced and the resource required for this is obtained.
바람직하게, 상기 피쳐 패턴 세트는, 미리 설정된 n 개의 피쳐 패턴의 세트 형태로 구성되며, 상기 피쳐 패턴은, 조건문 발생, 루프문 발생, 리턴문 발생, 브레이크(break) 또는 컨티뉴(continue)문 발생, 엑시트(exit) 또는 어서트(assert) 메소드 호출(method invocation) 발생, 널 표현(null expression) 발생, 널 값과의 비교(comparisons with a null value) 발생, 널 할당(null assignments) 발생, 널 값을 리턴하는 문(statements)의 발생 중의 어느 하나일 수 있다. 이를 표로 정리하면 다음과 같다. Preferably, the feature pattern set is configured in the form of a set of n feature patterns preset, wherein the feature pattern is a condition statement generation, loop statement generation, return statement generation, break or continue statement generation, An exit or assert method invocation, a null expression, a comparison with a null value, a null assignments, a null value It can be any one of the occurrences of statements that return. This is summarized as follows.
구분division 피처 패턴Feature pattern
1One 조건문 발생Conditional statement occurrence
22 루프문 발생 Loop statement occurrence
33 리턴문 발생Return statement occurs
44 브레이크(break) 또는 컨티뉴(continue)문 발생Break or continue statement occurs
55 엑시트(exit) 또는 어서트(assert) 메소드 호출(method invocation) 발생Exit or assert method invocation
66 널 표현(null expression) 발생Null expression occurs
77 널 값과의 비교(comparisons with a null value) 발생Encounters with a null value
88 널 할당(null assignments) 발생Null assignments occur
99 널 값을 리턴하는 문(statements)의 발생The occurrence of a statement that returns a null value
바람직한 일예로, 상기 피쳐 패턴 세트, 즉, n 개의 피쳐 패턴의 세트는 상기 오류 검출 경보의 각각의 경보 타입에 대하여 미리 설정된다. 이러한 설정 관계를 갖는 경우, 경보 유형 분류는 하나의 특정 경보 타입의 범위 내에서 이뤄지게 된다. In a preferred embodiment, the feature pattern set, i.e., the set of n feature patterns, is preset for each alert type of the error detection alert. In the case of such a setting relationship, the alarm type classification is made within the scope of one specific alarm type.
바람직하게, 상기 S4 단계에서, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))의 수득 과정은 다음과 같이 실행된다. Preferably, in step S4, a process of obtaining a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed is performed as follows.
S401 단계에서, 경보 유형 분류 장치는, 하기 수학식1과 같이, n 개의 피쳐 패턴(p)의 세트 형태로 구성된 피쳐 패턴 세트(P)를 정의한다. In operation S401, the alarm type classification apparatus defines a feature pattern set P configured in the form of a set of n feature patterns p, as shown in Equation 1 below.
[수학식1][Equation 1]
P = {p1, p2, ..., pn}P = {p 1 , p 2 , ..., p n }
S402 단계에서, 경보 유형 분류 장치는, 하기 수학식2와 같이, 추상 구문 트리 상의 임의의 노드 d에 대한 n 차원의 패턴 만족 벡터(v(P,d))를 정의한다. In operation S402, the alarm type classification apparatus defines an n-dimensional pattern satisfaction vector v (P, d) for any node d on the abstract syntax tree, as shown in Equation 2 below.
[수학식2][Equation 2]
Figure PCTKR2015012792-appb-I000005
Figure PCTKR2015012792-appb-I000005
(단, S(d,pi)는 임의의 노드 d 또는 노드 d를 루트로 하는 서브트리가 i 번째 피쳐 패턴(pi)에 매칭되는지 여부를 나타내는 인자로서, 하기 수학식3과 같이 정의되며, i 번째 피쳐 패턴(pi)은 단일 노드 또는 서브트리일 수 있음(Where S (d, p i ) is a factor indicating whether an arbitrary node d or a subtree rooted at node d matches the i th feature pattern p i , and is defined as in Equation 3 below. , i th feature pattern (p i ) can be a single node or a subtree
[수학식3][Equation 3]
Figure PCTKR2015012792-appb-I000006
)
Figure PCTKR2015012792-appb-I000006
)
S403 단계에서, 경보 유형 분류 장치는, 하기 수학식4와 같이, 추상 구문 트리 상의 임의의 노드 D에 대한 피쳐 벡터(V(P,D))를 정의한다. In operation S403, the apparatus for classifying an alert type defines a feature vector V (P, D) for any node D on the abstract syntax tree, as shown in Equation 4 below.
[수학식4][Equation 4]
Figure PCTKR2015012792-appb-I000007
Figure PCTKR2015012792-appb-I000007
(단, d1,...,dm은 임의의 노드 D의 자식 노드들이며, (Where d 1 , ..., d m are children of any node D,
V(P,d1)...V(P,dm) 는 자식 노드 d1,...,dm에 대하여 상기 수학식4를 통해 구한 피쳐 벡터이며, V (P, d 1 ) ... V (P, d m ) is a feature vector obtained through Equation 4 for the child nodes d 1 , ..., d m ,
v(P,D)는 임의의 노드 D에 대한 n 차원의 패턴 만족 벡터임)v (P, D) is an n-dimensional pattern satisfaction vector for any node D)
S404 단계에서, 경보 유형 분류 장치는, 하기 수학식5를 이용하여, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))를 수득한다. In operation S404, the apparatus for classifying an alert type obtains a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed using Equation 5 below.
[수학식5] [Equation 5]
Figure PCTKR2015012792-appb-I000008
Figure PCTKR2015012792-appb-I000008
(단, R은 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리의 루트 노드로서 상기 수학식4의 노드 D에 대응함)(Where R is the root node of the abstract syntax tree from which the unnecessary subtree is removed and corresponds to node D of Equation 4)
상기 수학식5는, 상기 수학식4의 임의의 노드 D로서, 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리의 루트 노드 R을 입력하여 구해지는 식으로 이해될 수도 있다. Equation 5 may be understood as an arbitrary node D of Equation 4 obtained by inputting a root node R of the abstract syntax tree from which an unnecessary subtree is removed.
S5 단계에서, 경보 유형 분류 장치는, 수득된 상기 피쳐 벡터(V(R))를 미리 설정된 방식으로 클러스터링하여 상기 피쳐 벡터에 대응하는 오류 검출 경보를 유형별로 분류하게 된다. In operation S5, the alarm type classification apparatus may cluster the obtained feature vector V (R) in a preset manner to classify the error detection alert corresponding to the feature vector by type.
클러스터링은 공지의 벡터 또는 데이터 클러스터링 기법이 사용될 수 있으며, 예를 들어, 공지의 계층적 클러스터링(Hierarchical Clustering) 기법, 또는 비계층적 클러스터링(Non-hierarchical Clustering) 기법이 사용될 수 있다. As the clustering, a known vector or data clustering technique may be used. For example, a known hierarchical clustering technique or a non-hierarchical clustering technique may be used.
본 실시예의 경우, 바람직한 일예로, 비계층적 클러스터링 방법 중 K-means 알고리즘이 사용될 수 있다. K-means는 데이터(또는 벡터)와 그 데이터(또는 벡터)가 속하는 클러스터의 중심(center)간의 유클리드 거리(Euclidean distance)를 최소화함으로써, 클러스터의 중심(centroid)을 찾아가는 방법이다. In the present embodiment, as a preferred example, the K-means algorithm in the non-hierarchical clustering method may be used. K-means is a method of finding the centroid of a cluster by minimizing the Euclidean distance between the data (or vector) and the center of the cluster to which the data (or vector) belongs.
K-means 알고리즘은 간단한 구조를 가지고 있고 일반적으로 빠르게 수렴하는 특성을 갖기 때문에 본 실시예에서 바람직한 일예로 적용될 수 있다. 더욱 정확한 클러스터링 결과를 얻기 위해, 서로 다른 초기값으로 여러 번 시도하여 가장 좋은 결과를 사용할 수도 있으며, 구하려는 클러스터의 갯수를 미리 적절한 갯수로 설정하여 클러스터링을 실행할 수도 있다. Since the K-means algorithm has a simple structure and generally has a fast convergence property, it can be applied as a preferable example in this embodiment. To get more accurate clustering results, you can try several times with different initial values and use the best results, or you can run clustering with the appropriate number of clusters to obtain in advance.
클러스터링에 의해, 유사도가 높은 피쳐 벡터들이 동일 유형으로 분류될 수 있으며, 그 결과 동일 유형으로 분류된 피쳐 벡터들에 대응하는 각각의 오류 검출 경보들도 동일 유형의 경보들로 분류될 수 있다. 일예로, 동일 유형으로 분류될 수 있는 유사도의 세부 조건은 경보 유형 분류 장치에 미리 설정될 수 있다. By clustering, feature vectors with high similarity may be classified into the same type, and as a result, respective error detection alerts corresponding to feature vectors classified into the same type may also be classified into the same type of alerts. For example, detailed conditions of similarity that may be classified into the same type may be preset in the alarm type classification device.
이러한 경보 유형 분류에 의해, 개발자는 오류 검출 경보의 분석에 있어서 여러가지 장점을 얻을 수 있다. This classification of alert types provides developers with several advantages in the analysis of error detection alerts.
예를 들어, 새로운 오류 검출 경보가 발생한 경우, 해당 오류 검출 경보가 기존에 정상 경보로 분류된 오류 검출 경보와의 유사도가 낮아 동일 유형이 아닌 것으로 분류된다면, 해당 오류 검출 경보를 우선적으로 분석하여 개발자는 오경보 여부를 우선적으로 판단할 수 있다. For example, when a new error detection alarm occurs, if the error detection alarm is classified as not the same type because of similarity with the error detection alarm classified as a normal alarm, the developer first analyzes the error detection alarm first. May first determine whether or not a false alarm is present.
본 발명의 실시예 들은 다양한 컴퓨터로 구현되는 동작을 수행하기 위한 프로그램과 이를 기록한 컴퓨터 판독가능 매체를 포함한다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체는 본 발명을 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD, USB 드라이브와 같은 광기록 매체, 플롭티컬 디스크와 같은 자기-광 매체, 및 롬, 램, 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 상기 매체는 프로그램 명령, 데이터 구조 등을 지정하는 신호를 전송하는 반송파를 포함하는 광 또는 금속선, 도파관 등의 전송 매체일 수도 있다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다.Embodiments of the present invention include a program for performing various computer-implemented operations and a computer readable medium recording the same. The computer readable medium may include program instructions, data files, data structures, etc. alone or in combination. The media may be those specially designed and constructed for the purposes of the present invention, or they may be of the kind well-known and available to those having skill in the computer software arts. Examples of computer readable recording media include magnetic media such as hard disks, floppy disks and magnetic tape, optical recording media such as CD-ROM, DVD, USB drives, magnetic-optical media such as floppy disks, and ROM, RAM, Hardware devices specifically configured to store and execute program instructions, such as flash memory, are included. The medium may be a transmission medium such as an optical or metal wire, a waveguide, or the like including a carrier wave for transmitting a signal specifying a program command, a data structure, or the like. Examples of program instructions include not only machine code generated by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like.

Claims (8)

  1. 정적분석기와 연동하는 경보 유형 분류 장치에서 실행되며, 정적분석기에서 발생한 오류 검출 경보를 유형별로 분류하기 위한 방법으로서, It is executed in the alarm type classification device linked with the static analyzer, and is a method for classifying error detection alarms generated by the static analyzer by type.
    1) 발생한 오류 검출 경보에 관한 경보 경로(alarm path) 정보 및 경보의 대상이 된 소스 코드 정보를 입력받는 단계- 상기 경보 경로 정보는 소스 코드의 실행 경로 중에서 상기 발생한 오류 검출 경보와 관련된 실행 경로에 관한 정보임-; 1) receiving alarm path information on an error detection alarm that has occurred and source code information that is an object of the alarm; the alarm path information is stored in an execution path related to the error detection alarm that has occurred in a source code execution path; Information about;
    2) 상기 소스 코드를 추상 구문 트리(abstract syntax tree, AST)로 변환하는 단계; 2) converting the source code into an abstract syntax tree (AST);
    3) 상기 추상 구문 트리에서 상기 오류 검출 경보와 관련되지 않은 불요 서브트리(unnecessary subtree)를 제거하는 단계; 3) removing an unnecessary subtree not associated with the error detection alert from the abstract syntax tree;
    4) 미리 설정된 피쳐 패턴 세트에 근거하여, 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터를 수득하는 단계; 및 4) obtaining a feature vector for the abstract syntax tree from which unnecessary subtrees have been removed based on a set of preset feature patterns; And
    5) 수득된 상기 피쳐 벡터를 미리 설정된 방식으로 클러스터링하여 상기 피쳐 벡터에 대응하는 오류 검출 경보를 유형별로 분류하는 단계;를 포함하여 구성된 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.5) clustering the obtained feature vectors in a predetermined manner to classify the error detection alerts corresponding to the feature vectors by type. 2.
  2. 제1항에 있어서, The method of claim 1,
    상기 1) 단계에서, In step 1) above,
    발생한 오류 검출 경보에 관한 경보 타입(alarm types) 정보를 더 입력받으며- 상기 경보 타입 정보는 발생한 오류 검출 경보가 미리 설정된 경보 타입 중에서 어느 타입에 해당하는지에 관한 정보임-, Further receiving alarm type information on an error detection alarm that has occurred, wherein the alarm type information is information on which type of alarm detection alarm corresponds to a preset alarm type;
    상기 4) 단계에서, In step 4),
    상기 피쳐 패턴 세트는 상기 오류 검출 경보의 경보 타입에 대하여 미리 설정된 것임을 특징으로 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.And the feature pattern set is preset for an alert type of the error detection alert.
  3. 제1항에 있어서, The method of claim 1,
    상기 3) 단계에서, 상기 불요 서브트리(unnecessary subtree)의 제거는, In the step 3), the removal of the unnecessary subtree (unnecessary subtree),
    오류 검출 경보와 관련된 실행 경로 상에서 실행된 구문을 제외한 다른 일반 구문을 제거하는 제1 정책과, A first policy for removing general syntax other than syntax executed on an execution path associated with an error detection alert;
    오류 검출 경보와 관련된 실행 경로 상에서 실행된 분기문이 아닌 다른 분기문을 제거하는 제2 정책과- 단, 오류 검출 경보와 관련된 실행 경로는 분기문의 조건 판별 결과를 포함함-, A second policy for removing a branch statement other than the branch statement executed on the execution path associated with the error detection alert, provided that the execution path related to the error detection alert includes the result of condition determination of the branch statement,
    오류 검출 경보와 관련된 실행 경로 상에서 실행된 반복문이 아닌 다른 반복문을 제거하는 제3 정책과, A third policy for removing loops other than loops executed on the execution path associated with the error detection alert;
    오류 검출 경보와 관련된 실행 경로 상에서 호출된 함수 및 상기 함수의 실행 경로를 상기 함수를 호출하는 노드의 서브트리로 포함하는 제4 정책과, A fourth policy comprising a function called on an execution path associated with an error detection alert and a execution path of the function as a subtree of a node invoking the function;
    오류 검출 경보와 관련된 실행 경로와 관계 없는 선언문을 제거하는 제5 정책 중의 적어도 어느 하나의 정책에 근거하여 이뤄지는 것을 특징으로 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.Method for classifying an alarm type in error detection of the source code, characterized in that based on at least one policy of the fifth policy for removing a statement irrelevant to the execution path associated with the error detection alert.
  4. 제1항에 있어서, The method of claim 1,
    상기 4) 단계에서, 상기 피쳐 패턴 세트는, In the step 4), the feature pattern set,
    미리 설정된 n 개의 피쳐 패턴의 세트 형태로 구성되며, It consists of a set of n preset feature patterns,
    상기 피쳐 패턴은, 조건문 발생, 루프문 발생, 리턴문 발생, 브레이크(break) 또는 컨티뉴(continue)문 발생, 엑시트(exit) 또는 어서트(assert) 메소드 호출(method invocation) 발생, 널 표현(null expression) 발생, 널 값과의 비교(comparisons with a null value) 발생, 널 할당(null assignments) 발생, 널 값을 리턴하는 문(statements)의 발생 중의 어느 하나인 것을 특징으로 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.The feature pattern may include a conditional statement occurrence, a loop statement occurrence, a return statement occurrence, a break or continue statement occurrence, an exit or assert method invocation, and a null expression. expression detection, occurrences of comparisons with a null value, occurrences of null assignments, or occurrences of statements that return null values. How to classify alarm types.
  5. 제1항에 있어서, The method of claim 1,
    상기 4) 단계에서, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))의 수득 과정은, In the step 4), the process of obtaining the feature vector V (R) for the abstract syntax tree from which the unnecessary subtree is removed is
    401) 하기 수학식1과 같이, n 개의 피쳐 패턴(p)의 세트 형태로 구성된 피쳐 패턴 세트(P)를 정의하는 단계; 401) defining a feature pattern set P composed of a set form of n feature patterns p as shown in Equation 1 below;
    [수학식1][Equation 1]
    P = {p1, p2, ..., pn}P = {p 1 , p 2 , ..., p n }
    402) 하기 수학식2와 같이, 추상 구문 트리 상의 임의의 노드 d에 대한 n 차원의 패턴 만족 벡터(v(P,d))를 정의하는 단계; 402) defining an n-dimensional pattern satisfaction vector v (P, d) for any node d on the abstract syntax tree as shown in Equation 2 below;
    [수학식2][Equation 2]
    Figure PCTKR2015012792-appb-I000009
    Figure PCTKR2015012792-appb-I000009
    (단, S(d,pi)는 임의의 노드 d 또는 노드 d를 루트로 하는 서브트리가 i 번째 피쳐 패턴(pi)에 매칭되는지 여부를 나타내는 인자로서, 하기 수학식3과 같이 정의되며, i 번째 피쳐 패턴(pi)은 단일 노드 또는 서브트리일 수 있음(Where S (d, p i ) is a factor indicating whether an arbitrary node d or a subtree rooted at node d matches the i th feature pattern p i , and is defined as in Equation 3 below. , i th feature pattern (p i ) can be a single node or a subtree
    [수학식3][Equation 3]
    Figure PCTKR2015012792-appb-I000010
    )
    Figure PCTKR2015012792-appb-I000010
    )
    403) 하기 수학식4와 같이, 추상 구문 트리 상의 임의의 노드 D에 대한 피쳐 벡터(V(P,D))를 정의하는 단계; 및 403) defining a feature vector V (P, D) for any node D on the abstract syntax tree, as shown in Equation 4 below; And
    [수학식4][Equation 4]
    Figure PCTKR2015012792-appb-I000011
    Figure PCTKR2015012792-appb-I000011
    (단, d1,...,dm은 임의의 노드 D의 자식 노드들이며, (Where d 1 , ..., d m are children of any node D,
    V(P,d1)...V(P,dm) 는 자식 노드 d1,...,dm에 대하여 상기 수학식4를 통해 구한 피쳐 벡터이며, V (P, d 1 ) ... V (P, d m ) is a feature vector obtained through Equation 4 for the child nodes d 1 , ..., d m ,
    v(P,D)는 임의의 노드 D에 대한 n 차원의 패턴 만족 벡터임)v (P, D) is an n-dimensional pattern satisfaction vector for any node D)
    404) 하기 수학식5를 이용하여, 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리에 대한 피쳐 벡터(V(R))를 수득하는 단계;를 포함하여 구성된 것을 특징으로 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.404) using Equation 5 below, obtaining a feature vector V (R) for the abstract syntax tree from which the unnecessary subtree has been removed; Method of classifying alarm types in error detection.
    [수학식5] [Equation 5]
    Figure PCTKR2015012792-appb-I000012
    Figure PCTKR2015012792-appb-I000012
    (단, R은 상기 불요 서브트리(unnecessary subtree)가 제거된 상기 추상 구문 트리의 루트 노드로서 상기 수학식4의 노드 D에 대응함)(Where R is the root node of the abstract syntax tree from which the unnecessary subtree is removed and corresponds to node D of Equation 4)
  6. 제1항에 있어서, The method of claim 1,
    상기 5) 단계에서, 상기 클러스터링은 K-means 알고리즘에 의해 실행되는 것을 특징으로 하는 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법.And in step 5), the clustering is performed by a K-means algorithm.
  7. 하드웨어와 결합되어 제1항 내지 제6항 중의 어느 한 항에 따른 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 실행시키기 위하여 매체에 저장된 컴퓨터 프로그램.A computer program, coupled with hardware, stored on a medium for executing an alarm type classification method in the error detection of source code according to any one of the preceding claims.
  8. 제1항 내지 제6항 중의 어느 한 항에 따른 소스 코드의 오류 검출에 있어서 경보 유형 분류 방법을 컴퓨터에서 실행하기 위한 컴퓨터 프로그램이 기록된, 컴퓨터로 판독 가능한 기록 매체.A computer-readable recording medium having recorded thereon a computer program for executing an alarm type classification method in a computer in detecting an error of a source code according to any one of claims 1 to 6.
PCT/KR2015/012792 2014-11-28 2015-11-26 Method for classifying alarm types in detecting source code error, computer program therefor, recording medium thereof WO2016085273A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US15/528,792 US10394687B2 (en) 2014-11-28 2015-11-26 Method for classifying alarm types in detecting source code error and nontransitory computer readable recording medium therefor
JP2017528221A JP6369736B2 (en) 2014-11-28 2015-11-26 Alarm type classification method in error detection of source code, computer program therefor, and recording medium therefor

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
KR10-2014-0168971 2014-11-28
KR20140168971 2014-11-28
KR10-2015-0028436 2015-02-27
KR1020150028436A KR101694783B1 (en) 2014-11-28 2015-02-27 Alarm classification method in finding potential bug in a source code, computer program for the same, recording medium storing computer program for the same

Publications (1)

Publication Number Publication Date
WO2016085273A1 true WO2016085273A1 (en) 2016-06-02

Family

ID=56074710

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2015/012792 WO2016085273A1 (en) 2014-11-28 2015-11-26 Method for classifying alarm types in detecting source code error, computer program therefor, recording medium thereof

Country Status (1)

Country Link
WO (1) WO2016085273A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110347428A (en) * 2018-04-08 2019-10-18 北京京东尚科信息技术有限公司 A kind of detection method and device of code similarity
CN110413490A (en) * 2019-08-01 2019-11-05 北京百度网讯科技有限公司 Determine method, the error message code classification method and device of type of error message
CN117453578A (en) * 2023-12-25 2024-01-26 杭州云动智能汽车技术有限公司 NMEA sentence detection method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100333069A1 (en) * 2009-06-29 2010-12-30 International Business Machines Corporation Static code analysis
US20110078651A1 (en) * 2009-09-28 2011-03-31 Cadence Design Systems, Inc. Method and system for test reduction and analysis
EP2369529A1 (en) * 2010-03-24 2011-09-28 Alcatel Lucent A method of detecting anomalies in a message exchange, corresponding computer program product, and data storage device therefor
US20120216280A1 (en) * 2011-02-18 2012-08-23 Microsoft Corporation Detection of code-based malware
US20130145215A1 (en) * 2011-12-04 2013-06-06 International Business Machines Corporation Eliminating false-positive reports resulting from static analysis of computer software

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100333069A1 (en) * 2009-06-29 2010-12-30 International Business Machines Corporation Static code analysis
US20110078651A1 (en) * 2009-09-28 2011-03-31 Cadence Design Systems, Inc. Method and system for test reduction and analysis
EP2369529A1 (en) * 2010-03-24 2011-09-28 Alcatel Lucent A method of detecting anomalies in a message exchange, corresponding computer program product, and data storage device therefor
US20120216280A1 (en) * 2011-02-18 2012-08-23 Microsoft Corporation Detection of code-based malware
US20130145215A1 (en) * 2011-12-04 2013-06-06 International Business Machines Corporation Eliminating false-positive reports resulting from static analysis of computer software

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110347428A (en) * 2018-04-08 2019-10-18 北京京东尚科信息技术有限公司 A kind of detection method and device of code similarity
CN110413490A (en) * 2019-08-01 2019-11-05 北京百度网讯科技有限公司 Determine method, the error message code classification method and device of type of error message
CN110413490B (en) * 2019-08-01 2023-07-14 阿波罗智能技术(北京)有限公司 Method for determining error information type, error information code classification method and device
CN117453578A (en) * 2023-12-25 2024-01-26 杭州云动智能汽车技术有限公司 NMEA sentence detection method and device, electronic equipment and storage medium
CN117453578B (en) * 2023-12-25 2024-04-19 杭州云动智能汽车技术有限公司 NMEA sentence detection method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
JP6369736B2 (en) Alarm type classification method in error detection of source code, computer program therefor, and recording medium therefor
WO2016085272A1 (en) Method for reducing false alarms in detecting source code error, computer program therefor, recording medium thereof
Han et al. MalDAE: Detecting and explaining malware based on correlation and fusion of static and dynamic characteristics
US7809670B2 (en) Classification of malware using clustering that orders events in accordance with the time of occurance
WO2017213400A1 (en) Malware detection by exploiting malware re-composition variations
WO2017131263A1 (en) Hybrid instance selection method using nearest neighboring point for cross project defect prediction
US9697058B2 (en) Method, computer program and apparatus for controlling access to a computer resource and obtaining a baseline therefor
WO2016085273A1 (en) Method for classifying alarm types in detecting source code error, computer program therefor, recording medium thereof
WO2018016671A2 (en) Dangerous code detection system for checking security vulnerability and method thereof
CN108491228A (en) A kind of binary vulnerability Code Clones detection method and system
Aafer et al. Android {SmartTVs} vulnerability discovery via {log-guided} fuzzing
US20080127043A1 (en) Automatic Extraction of Programming Rules
Bian et al. Detecting bugs by discovering expectations and their violations
Habib et al. Neural bug finding: A study of opportunities and challenges
CN109657461B (en) RTL hardware Trojan horse detection method based on gradient lifting algorithm
KR102318991B1 (en) Method and device for detecting malware based on similarity
Kim et al. Malicious behavior detection method using api sequence in binary execution path
Zhang et al. Slowing down the aging of learning-based malware detectors with api knowledge
CN115883218B (en) Multi-mode data model-based composite attack chain completion method, system and medium
Jang et al. An intelligent trend prediction and reversal recognition system using dual-module neural networks
CN109002716A (en) A kind of malicious code intrusion detection of mobile application and prevention method
US11270000B1 (en) Generation of file digests for detecting malicious executable files
Cheng et al. Multi-IF: An approach to anomaly detection in self-driving systems
Yokomori et al. Use-Relationship Based Classification for Software Components.
KR101694778B1 (en) False alarm reducing method in finding potential bug in a source code, computer program for the same, recording medium storing computer program for the same

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15863447

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15528792

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2017528221

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15863447

Country of ref document: EP

Kind code of ref document: A1