WO2021084735A1 - ソースコード解析装置 - Google Patents

ソースコード解析装置 Download PDF

Info

Publication number
WO2021084735A1
WO2021084735A1 PCT/JP2019/043034 JP2019043034W WO2021084735A1 WO 2021084735 A1 WO2021084735 A1 WO 2021084735A1 JP 2019043034 W JP2019043034 W JP 2019043034W WO 2021084735 A1 WO2021084735 A1 WO 2021084735A1
Authority
WO
WIPO (PCT)
Prior art keywords
analysis
function
source code
processing unit
input
Prior art date
Application number
PCT/JP2019/043034
Other languages
English (en)
French (fr)
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
Application filed by 三菱電機株式会社 filed Critical 三菱電機株式会社
Priority to PCT/JP2019/043034 priority Critical patent/WO2021084735A1/ja
Priority to JP2021554024A priority patent/JP7237186B2/ja
Priority to US17/761,327 priority patent/US11907710B2/en
Publication of WO2021084735A1 publication Critical patent/WO2021084735A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/75Structural analysis for program understanding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs

Definitions

  • the present invention relates to a source code analyzer.
  • the methods for analyzing software source code are roughly divided into static analysis methods and dynamic analysis methods.
  • the static analysis method analyzes the static structure of the source code to detect the presence or absence of software defects.
  • the dynamic analysis method comprehensively detects the presence or absence of defects in all combinations of function arguments, function return values, global variables, and other input values for each function included in the source code, resulting in software defects. Detect the presence or absence.
  • the dynamic analysis method can detect defects that cannot be detected by the static analysis method such as overflow of arithmetic digits.
  • the dynamic analysis method is adopted in Polyspace (registered trademark) manufactured by MathWorks.
  • Patent Document 1 relates to source code verification (name of invention).
  • a function that directly receives the changed condition and a function that directly calls the function are used. It is detected as a base point function in a group of functions that need to be verified (paragraph 0015).
  • Patent Document 2 relates to software inspection (name of invention).
  • the presence or absence of is determined (paragraph 0007).
  • Patent Document 3 relates to application analysis (name of invention).
  • the modification contents of the program due to the change of the range of the input data item are estimated according to the range based on the assumed requirement information (paragraph 0017).
  • the software development project is a large-scale project, a huge amount of source code will be created. Therefore, when the created source code is analyzed by the dynamic analysis method, the number of combinations of input values increases, and the time required to analyze the created source code becomes long. Therefore, when the software development project is a large-scale project, it is difficult to construct an environment for analyzing the created source code by a dynamic analysis method.
  • An object of the present invention is to shorten the time required to analyze a source code in a source code analysis device that analyzes the source code by a dynamic analysis method without lowering the analysis accuracy.
  • the present invention relates to a source code analyzer.
  • the source code analysis device includes a change function extraction processing unit, an analysis processing unit, an analysis necessity determination processing unit, and an analysis result processing unit.
  • the change function extraction processing unit extracts the change function included in the changed part from the source code before the change, which is included in the source code after the change.
  • the analysis necessity determination processing unit determines whether or not the function is the analysis target function based on the range of the input values input to the function included in the change function and the influence function.
  • the analysis processing unit analyzes the function to be analyzed that is determined by the analysis necessity judgment processing unit to require analysis.
  • the analysis result processing unit outputs the analysis result of the modified source code including the analysis result of the function to be analyzed.
  • the analysis target function to be analyzed is limited to the change function included in the changed source code from the changed source code and the influence function given by the changed function. To. Therefore, the time required to analyze the source code after the change can be shortened.
  • the analysis target function to be analyzed is further limited based on the range of input values input to the function. Therefore, the time required to analyze the source code after the change can be further shortened.
  • FIG. 1 It is a block diagram which schematically illustrates the hardware configuration of the source code analysis apparatus of Embodiment 1-6. It is a block diagram which shows typically the functional structure of the source code analysis apparatus of Embodiment 1.
  • FIG. It is a table which shows the example of the range information stored in the source code analysis apparatus of Embodiment 1. It is a table which shows the example of the determination information stored in the source code analysis apparatus of Embodiment 1.
  • It is a flowchart which illustrates the flow of the process performed by the source code analysis apparatus of Embodiment 1.
  • FIG. It is a flowchart which illustrates the flow of the process performed by the source code analysis apparatus of Embodiment 1.
  • FIG. It is a block diagram which shows typically the functional structure of the source code analysis apparatus of Embodiment 2.
  • FIG. 1 is a block diagram schematically showing the hardware configuration of the source code analysis device according to the first embodiment.
  • the source code analysis device 1 illustrated in FIG. 1 is a personal computer (PC) in which the source code analysis program 21 is installed.
  • PC personal computer
  • the source code analysis device 1 includes a processor 11, a memory 12, and a storage 13.
  • the source code analysis program 21 is installed in the storage 13.
  • the source code analysis program 21 may be installed by writing the source code analysis program 21 read from the external recording medium 31 to the storage 13, or storing the source code analysis program 21 received via the network 32. It may be done by writing in 13.
  • the processor 11 is a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing device (DSP), and the like.
  • the memory 12 is a random access memory (RAM) or the like.
  • the storage 13 is a hard disk drive, a solid state drive, a RAM disk, or the like.
  • the external recording medium 31 is a compact disc (CD), a digital multipurpose disc (DVD), a Blu-ray disc (BD), a universal serial bus (USB) memory, or the like.
  • the memory 12, the storage 13, and the external recording medium 31 are non-temporary, computer-readable recording media on which the source code analysis program 21 is recorded.
  • the source code analysis program 21 installed in the storage 13 is loaded into the memory 12, and the loaded source code analysis program 21 is executed by the processor 11, so that the PC becomes the source code analysis device. Functions as 1.
  • FIG. 2 is a block diagram schematically illustrating the functional configuration of the source code analysis apparatus of the first embodiment.
  • the source code analysis device 1 illustrated in FIG. 2 analyzes the source code by a dynamic analysis method.
  • the source code analysis device 1 is input with the changed source code 41 and the analysis result 42 of the unchanged source code.
  • the source code analysis device 1 generates an analysis result 43 of the changed source code by analyzing the changed source code 41 using the input analysis result 42 of the changed source code, and generates an analysis result 43 of the changed source code of the generated changed source code.
  • the analysis result 43 is output.
  • the input changed source code 41, the analysis result 42 of the changed source code, and the output changed source code analysis result 43 are files.
  • the source code analysis device 1 includes a change function extraction processing unit 51, an analysis processing unit 52, an analysis necessity determination processing unit 53, an analysis result processing unit 54, and a storage unit 55.
  • the storage unit 55 may be provided outside the source code analysis device 1.
  • the change function extraction processing unit 51, the analysis processing unit 52, the analysis necessity determination processing unit 53, and the analysis result processing unit 54 are configured by the processor 11 executing the source code analysis program 21.
  • the change function extraction processing unit 51, the analysis processing unit 52, the analysis necessity determination processing unit 53, and the analysis result processing unit 54 may be configured in whole or in part by hardware that does not execute the program.
  • the storage unit 55 is composed of at least one of the memory 12 and the storage 13.
  • the storage unit 55 stores the unchanged source code 44 and the analysis result 45.
  • the analysis result 45 includes the range information 71 and the determination information 72.
  • the analysis result 45 is generated by expanding the analysis result 42 of the source code before the change and updating the expanded analysis result.
  • the range information 71 indicates a range of input values input to the function.
  • the determination information 72 indicates the result of determining whether or not a defect occurs in each line included in the analysis target function.
  • the result of determining whether or not a defect occurs is, for example, "safety”, “danger”, or “danger depending on the conditions”. "Safety” indicates that no malfunction occurs. "Danger” indicates that a defect will definitely occur. “Dangerous depending on the conditions” indicates that a defect may occur depending on the conditions.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 1 and the unchanged source code 44 stored in the storage unit 55.
  • the change function extraction processing unit 51 extracts the change function included in the changed part from the acquired source code 44 before change, which is included in the acquired source code 41 after change.
  • the change function extraction processing unit 51 extracts the difference between the changed source code 41 and the changed source code 44.
  • the extracted difference includes information on the functions and global variables modified from the functions and global variables included in the source code 44 before modification, and the functions and global variables added to the source code 44 before modification, respectively.
  • the change function extraction processing unit 51 extracts the change function from the extracted difference with reference to the information.
  • the extracted modified functions are the functions modified from the functions included in the unmodified source code 44 and the functions added to the unmodified source code 44.
  • the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55 after extracting the difference.
  • the stored modified source code 41 is used as the unmodified source code 44 when the modified source code 41 next input to the source code analysis device 1 is analyzed.
  • the analysis processing unit 52 acquires the change function extracted by the change function extraction processing unit 51.
  • the analysis processing unit 52 extracts the influence function given by the acquired change function from the changed source code 41. If the change function gives an input to the influence function, the input value is input to the influence function. The extracted influence function and the input values input to it are affected by the change of the change function.
  • the function funcA () rewrites the global variable g_val_A and the function funcB (arg1) reads the global variable g_val_A
  • the function funcA () gives input to the function funcB (arg1) and the global variable g_val_A goes to the function funcB (arg1). It is an input value to be input.
  • the analysis necessity determination processing unit 53 includes the change function extracted by the change function extraction processing unit 51, the influence function extracted by the analysis processing unit 52, and the range information 71 included in the analysis result 45 stored in the storage unit 55. To get.
  • the analysis necessity determination processing unit 53 determines whether or not the acquired change function and the function included in the influence function are the analysis target functions. When determining whether or not the function is the analysis target function, the analysis necessity determination processing unit 53 determines whether or not the function is the analysis target function based on the range of the input values input to the function. judge. In the first embodiment, the analysis necessity determination processing unit 53 determines that the range of input values input to the function in the changed source code 41 is the range of the input values input to the function in the unchanged source code 44. If it is narrower, it is determined that the function is not the function to be analyzed, and the range of input values input to the function in the modified source code 41 is the range of the input values input to the function in the unmodified source code 44. If it is wider, it is determined that the function is the function to be analyzed.
  • the input value input to the function includes at least one selected from the group consisting of the argument of the function, the return value returned by another function called by the function, and the global variables read by the function.
  • the range of arguments is determined by parsing the arguments given to the function when the function with the arguments is called.
  • the range of return values is determined by analyzing the entire function.
  • the range of a global variable is determined by analyzing the function that rewrites the global variable.
  • the analysis necessity determination processing unit 53 notifies the analysis processing unit 52 of the result of determining whether or not the variable is the analysis target function. As a result, the analysis processing unit 52 can analyze the analysis target function determined to be required by the analysis necessity determination processing unit 53.
  • the analysis processing unit 52 analyzes the analysis target function included in the acquired change function and the extracted influence function, which is determined by the analysis necessity determination processing unit 53 to require analysis. However, the analysis processing unit 52 does not necessarily have to analyze a function other than the analysis target function, except for the process of extracting the influence function described above. Therefore, in the first embodiment, the analysis processing unit 52 does not analyze the functions other than the analysis target function except the processing for extracting the influence function described above.
  • the analysis of the analysis target function includes determining whether or not a defect occurs in each line included in the analysis target function. In the analysis of the analysis target function, the analysis processing unit 52 swings the input value input to the analysis target function for verification. The result of determining whether or not a defect occurs is, for example, "safety", “danger”, or “danger depending on the conditions".
  • the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 1.
  • the analysis processing unit 52 expands the analysis result 42 of the acquired source code before change to generate the analysis result. Further, the analysis processing unit 52 updates the generated analysis result so that the updated analysis result 45 includes the analysis result of the analysis target function. Further, the analysis processing unit 52 stores the updated analysis result 45 in the storage unit 55. When updating the analysis result 45, the analysis processing unit 52 includes the range information 71 and the determination information 72 in the analysis result 45.
  • the analysis result processing unit 54 acquires the stored analysis result 45.
  • the analysis result processing unit 54 generates the analysis result 43 of the modified source code based on the acquired analysis result 45.
  • the analysis result 43 of the generated modified source code includes the analysis result of the function to be analyzed.
  • analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • FIG. 3 is a table showing an example of range information stored in the source code analysis apparatus of the first embodiment.
  • the range information 71 includes a plurality of elements 81 as shown in FIG.
  • Each element included in the plurality of elements 81 includes an identifier (ID), a function name, a variable name, an input type, an upper limit value, and a lower limit value, as shown in FIG.
  • ID indicates a number assigned to each element.
  • the number assigned to each element is a unique number for each element.
  • the function name indicates the function name of the function targeted by each element.
  • variable name indicates the variable name of the variable in which the input value input to the function targeted by each element is entered.
  • the input type indicates the type of input value input to the function targeted by each element.
  • the input type is an argument, a return value or a global variable. If the input type is a return value, the input type also indicates the function name of the function that returns the return value.
  • the upper limit value and the lower limit value indicate the upper limit value and the lower limit value of the range of input values input to the function targeted by each element, respectively.
  • the upper limit value and the lower limit value are determined by the analysis processing unit 52 determining the range of input values input to the function.
  • the range information 71 includes elements with IDs 0, 1, 2, and 3.
  • the arguments arg1 and arg2 of the function funcA are input to the function funcA
  • the argument arg1 has a range of 0 or more and 10 or less
  • the argument arg2 is -5 or more and 5 or less.
  • the element given the ID of 2 indicates that the return value retVal returned by the function funcC is input to the function funcB, and the return value retVal has a range of 1 or more and 100 or less.
  • the element given the ID of 3 indicates that the global variable g_val is input to the function funcC and the global variable g_val has a range of 0 or more and 5 or less.
  • FIG. 4 is a table showing an example of judgment information stored in the source code analysis apparatus of the first embodiment.
  • the determination information 72 includes a plurality of elements 91 as shown in FIG.
  • each element included in the plurality of elements 91 includes an ID, a file path, a function name, the number of lines, a determination, a defect occurrence value, and a defect content.
  • ID indicates a number assigned to each element.
  • the number assigned to each element is a unique number for each element.
  • the file path indicates the file path of the file containing the line for which the determination for each element has been made.
  • the function name indicates the function name of the function including the line in which the judgment targeted by each element is made.
  • the number of lines indicates the number of lines for which the determination for each element has been made.
  • Judgment indicates the result of judgment targeted by each element.
  • the result of the determination is, for example, "safe”, “danger” or “danger depending on the conditions”.
  • the defect occurrence value is the variable name in which the input value determined to be dangerous is entered when the result of the determination targeted by each element is "dangerous" or “dangerous depending on the conditions", and is considered to be dangerous. Indicates the range of determined input values.
  • the content of the defect indicates the content of the defect that occurs when the result of the judgment targeted by each element is "danger” or “danger depending on the conditions".
  • the determination information 72 illustrated in FIG. 4 includes elements with IDs 0, 1, 2, and 3.
  • the elements with IDs 0, 1, 2, and 3 indicate that the lines contained in the file having the file path prj / mod1 / src.c have been determined.
  • the element given the ID of 0 indicates that the problem does not occur in the 10th line included in the function funcA.
  • the element given the ID of 1 indicates that a problem does not occur in the 11th line included in the function funcA.
  • the element given the ID of 2 indicates that a digit overflow problem occurs when the input value arg is 5 or more and 10 or less in the 21st line included in the function funcB.
  • the element given the ID of 3 indicates that no problem occurs in the 22nd line included in the function funcB.
  • FIGS. 5 and 6 are flowcharts illustrating a flow of processing performed by the source code analysis device according to the first embodiment.
  • the source code analysis device 1 has analyzed the source code in the past, the storage unit 55 stores the source code 44 before the change, and the analysis result 42 of the source code before the change exists. Under such circumstances, steps S101 to S113 illustrated in FIGS. 5 and 6 are executed.
  • step S101 the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 1.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 1 and the unchanged source code 44 stored in the storage unit 55. Further, the change function extraction processing unit 51 extracts the difference between the changed source code 41 and the changed source code 44. Further, the change function extraction processing unit 51 extracts the change function from the extracted difference. Further, the change function extraction processing unit 51 adds the extracted change function to the analysis target list. Further, the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55.
  • step S104 the analysis processing unit 52 extracts the function included in the analysis target list.
  • step S105 the analysis processing unit 52 analyzes the extracted function.
  • the analysis processing unit 52 extracts the influence function that the analyzed function affects the input from the changed source code 41.
  • the extracted influence function may be one function or multiple functions. Further, the analysis processing unit 52 adds the extracted influence function to the determination target list.
  • step S108 the analysis necessity determination processing unit 53 extracts the function included in the determination target list.
  • the analysis necessity determination processing unit 53 acquires the range information 71 included in the analysis result 45 stored in the storage unit 55. Further, in the analysis necessity determination processing unit 53, whether the range of the input value input to the function fetched in the changed source code 41 is wider than the range of the input value input to the function fetched in the unchanged source code 44. Judge whether or not. If it is determined that the range of the former input value is wider than the range of the latter input value, step S110 is executed. If it is determined that the range of the former input value is narrower than the range of the latter input value, step S111 is executed. As a result, it is determined whether or not the extracted function is the analysis target function.
  • step S110 the analysis necessity determination processing unit 53 adds the extracted function to the analysis target list. As a result, the analysis target function is added to the analysis target list.
  • step S113 the analysis result processing unit 54 acquires the analysis result 45. Further, the analysis result processing unit 54 collectively generates the analysis result 43 of the changed source code by collecting the acquired analysis results 45. Further, the analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • the analysis target function to be analyzed is included in the changed source code 41 from the changed source code 44. It is limited to the change function that is used and the influence function that can be input by the change function. Therefore, the time required to analyze the modified source code 41 can be shortened.
  • the analysis target function to be analyzed is further limited based on the range of the input value input to the function. Therefore, the time required to analyze the modified source code 41 can be further shortened.
  • the analysis result 43 of the modified source code similar to the analysis result can be output. Therefore, the time required to analyze the modified source code 41 can be shortened without lowering the accuracy of the analysis.
  • FIG. 1 is also a block diagram schematically illustrating the hardware configuration of the source code analysis device according to the second embodiment.
  • FIG. 7 is a block diagram schematically illustrating the functional configuration of the source code analysis device according to the second embodiment.
  • the source code analysis device 2 of the second embodiment shown in FIG. 7 is different from the source code analysis device 1 of the first embodiment shown in FIG. 2 in that it further includes a verified information storage processing unit 56.
  • the verified information storage processing unit 56 stores the verified information indicating the value verified by the analysis processing unit 52 in the storage unit 55.
  • the stored verified information is included in the range information 71.
  • the verified information included in the range information 71 is a verified value range indicating a range of values for which verification has been performed.
  • the analysis processing unit 52 inputs input to the analysis target function other than the verified value indicated by the verified information when the analysis processing unit 52 has already performed the verification. Perform verification by assigning a value. As a result, the analysis processing unit 52 performs new verification by waving the input value input to the analysis target function for the value that has not been verified. As a result, the time required to analyze the modified source code 41 can be further shortened.
  • FIG. 8 is a table showing an example of range information stored in the source code analysis device of the second embodiment.
  • the range information 71 illustrated in FIG. 8 differs from the range information 71 illustrated in FIG. 3 in that it includes a verified range.
  • the verified range indicates the range in which the input value input to the function targeted by each element has been verified.
  • the verified range is updated by the verified information storage processing unit 56 after being verified by the analysis processing unit 52.
  • the element with the ID of 0 indicates that the argument arg1 has already been verified in the range of 0 or more and 5 or less. Therefore, after the verification is performed, the analysis processing unit 52 verifies a value smaller than 0 or a value larger than 5.
  • the element given the ID of 1 indicates that the argument arg2 has already been verified in the range of -5 or more and 5 or less. Therefore, after the verification is performed, the analysis processing unit 52 verifies a value smaller than ⁇ 5 or a value larger than 5.
  • the element given the ID of 2 indicates that the return value retVal has already been verified in the range of 1 or more and 50 or less. Therefore, after the verification is performed, the analysis processing unit 52 verifies a value smaller than 1 or a value larger than 50.
  • the element given the ID of 3 indicates that the global variable g_val has already been verified in the range of 0 or more and 5 or less. Therefore, after the verification is performed, the analysis processing unit 52 verifies a value smaller than 0 or a value larger than 5.
  • FIG. 9 is a flowchart illustrating the flow of processing performed by the source code analysis apparatus of the second embodiment.
  • the source code analysis device 2 executes steps S201 to S208 shown in FIG.
  • step S201 the analysis processing unit 52 acquires the verified range included in the range information 71 stored in the storage unit 55.
  • the analysis processing unit 52 acquires the range included in the range information 71 stored in the storage unit 55.
  • the process is repeatedly executed until the processes from steps S204 to S206 are executed for all the verification values within the range of the range.
  • the verification value is increased from the lower limit of the range to the upper limit of the range each time the process is executed.
  • step S204 the analysis processing unit 52 determines whether or not the verification value is outside the range indicated by the acquired verified range. If it is determined that the verification value is out of the acquired verified range, step S205 is executed. If it is determined that the verification value is within the range indicated by the acquired verified range, step S207 is executed.
  • step S205 the analysis processing unit 52 verifies the analysis target function for the verification value. The verification is performed on all the rows included in the analysis target function.
  • the verified information storage processing unit 56 updates the verified value range so that the range indicated by the verified range included in the range information 71 stored in the storage unit 55 includes the verification value. .. As a result, the lower limit value or the upper limit value of the verified range is updated.
  • step S208 the analysis processing unit 52 updates the analysis result 45.
  • the source code analysis device 2 of the second embodiment has the same effect as that of the source code analysis device 1 of the first embodiment.
  • the source code analysis device 2 of the second embodiment it is possible to suppress re-verification of the verified value. Therefore, the time required to analyze the modified source code 41 can be shortened.
  • Embodiment 3 the difference between the source code analysis device of the third embodiment and the source code analysis device 1 of the first embodiment will be described. Regarding the points not explained, the same configuration as that adopted in the source code analysis apparatus 1 of the first embodiment is adopted in the source code analysis apparatus of the third embodiment.
  • FIG. 1 is also a block diagram schematically illustrating the hardware configuration of the source code analysis device according to the third embodiment.
  • FIG. 10 is a block diagram schematically illustrating the functional configuration of the source code analysis device according to the third embodiment.
  • the source code analysis device 3 of the third embodiment illustrated in FIG. 10 is further input with software hierarchy information 46, further includes a hierarchy identification processing unit 57 and an analysis order designation unit 58, and the software hierarchy information 47 is stored in the storage unit 55. It differs from the source code analysis device 1 of the first embodiment shown in FIG. 2 in that it is further stored in.
  • the software hierarchy information 46 to be input is a file.
  • the software hierarchy information 46 shows the hierarchical structure of the functions included in the modified source code 41.
  • the software hierarchy information 47 shows a call tree of functions included in the modified source code 41.
  • the call tree shows the calling order of the function. Therefore, by referring to the software hierarchy information 47, it is possible to distinguish between the function included in the upper module of the software and the function included in the lower module of the software.
  • the layer identification processing unit 57 acquires the software layer information 46 input to the source code analysis device 3.
  • the layer identification processing unit 57 changes from the hierarchical structure of the function included in the modified source code 41 indicated by the acquired software hierarchical information 46 to the software hierarchical information indicating the call tree of the function included in the modified source code 41. Generate 47.
  • the hierarchy specifying processing unit 57 can specify the hierarchy to which the analysis target function belongs in the hierarchical structure of the functions included in the modified source code 41.
  • the layer identification processing unit 57 stores the generated software layer information 47 in the storage unit 55.
  • the analysis order specification unit 58 specifies the analysis order of the analysis target function.
  • the analysis order of the specified analysis target function indicates the analysis priority of the analysis target function. Therefore, when the analysis order of the analysis target functions is specified, the analysis processing unit 52 changes the analysis target function having a high analysis priority to the analysis target function having a low analysis priority in the analysis order order of the analysis target functions. Analyze the function to be analyzed.
  • the analysis order of the analysis target function specified by the analysis order specification unit 58 is such that the higher the hierarchy to which the analysis target function belongs in the hierarchical structure of the function included in the modified source code 41 specified by the hierarchy identification processing unit 57, the earlier. become.
  • the analysis processing unit 52 analyzes the analysis target functions in the analysis order of the designated analysis target functions. As a result, the analysis processing unit 52 analyzes the analysis target function in order from the analysis target function included in the upper module to the analysis target function included in the lower module. Further, the analysis processing unit 52 analyzes the analysis target function in the order in which the analysis target function is called.
  • FIG. 11 is a tree showing an example of a hierarchical structure indicated by software hierarchical information input to the source code analysis device of the first embodiment.
  • FIG. 12 is a table showing an example of the hierarchy number assigned to the function included in the hierarchy structure indicated by the software hierarchy information input to the source code analysis apparatus of the first embodiment.
  • the tree 101 illustrated in FIG. 11 shows that the hierarchical structure indicated by the software hierarchy information 46 includes the functions funcA, funcB, funcC, funcD, funcE and funcF. Further, the tree 101 indicates that the function funcA belongs to a hierarchy one level higher than the hierarchy to which the functions funcB and funcC belong. Further, the tree 101 indicates that the function funcB belongs to a hierarchy one level higher than the hierarchy to which the functions funcD and funcE belong. Further, the tree 101 indicates that the function funcC belongs to a hierarchy one level higher than the hierarchy to which the function funcF belongs.
  • the functions funcD, funcE, and funcF that belong to the lower hierarchy are assigned hierarchy numbers in that order
  • the functions funcA, funcB, funcC, funcD, funcE, and funcF are assigned hierarchy numbers 0,1,2,3,4, and 5, respectively. Will be done. A younger hierarchy number assigned to a function indicates that the analysis of the function has a higher priority.
  • 13 and 14 are flowcharts illustrating the flow of processing performed by the source code analysis apparatus of the third embodiment.
  • the source code analysis device 3 executes steps S301 to S315 shown in FIGS. 13 and 14.
  • step S301 the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 3.
  • the layer identification processing unit 57 acquires the software layer information 46 input to the source code analysis device 3. Further, the hierarchy identification processing unit 57 extracts the hierarchy structure from the acquired software hierarchy information 46. Further, the hierarchy specifying processing unit 57 assigns a hierarchy number to the functions included in the hierarchy structure in order from the function belonging to the higher hierarchy.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 3 and the unchanged source code 44 stored in the storage unit 55. Further, the change function extraction processing unit 51 extracts the difference between the acquired source code after change 41 and the acquired source code before change 44. Further, the change function extraction processing unit 51 extracts the change function from the extracted difference. Further, the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55.
  • step S304 the change function extraction processing unit 51 adds the extracted change function and the hierarchy number assigned to it to the analysis target list.
  • step S306 the analysis processing unit 52 extracts the function included in the analysis target list.
  • the analysis processing unit 52 retrieves the function to which the youngest hierarchy number is assigned. As a result, the analysis target functions are analyzed in order from the analysis target functions belonging to the higher hierarchy.
  • step S307 the analysis processing unit 52 analyzes the extracted function.
  • step S308 the analysis processing unit 52 extracts the influence function that the analyzed function affects the input from the changed source code 41. Further, the analysis processing unit 52 adds the extracted influence function to the determination target list.
  • step S310 the analysis necessity determination processing unit 53 extracts the function included in the determination target list.
  • the analysis necessity determination processing unit 53 acquires the range information 71 included in the analysis result 45 stored in the storage unit 55. Further, in the analysis necessity determination processing unit 53, whether the range of the input value input to the function fetched in the changed source code 41 is wider than the range of the input value input to the function fetched in the unchanged source code 44. Judge whether or not. If it is determined that the range of the former input value is wider than the range of the latter input value, step S312 is executed. If it is determined that the range of the former input value is narrower than the range of the latter input value, step S313 is executed.
  • step S312 the analysis necessity determination processing unit 53 adds the extracted function and the hierarchy number assigned to it to the analysis target list. As a result, the analysis target function and the hierarchy number indicating the priority of the analysis are added to the analysis target list.
  • step S315 the analysis result processing unit 54 acquires the analysis result 45. Further, the analysis result processing unit 54 collectively generates the analysis result 43 of the changed source code by collecting the acquired analysis results 45. Further, the analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • the source code analysis device 3 of the third embodiment has the same effect as that of the source code analysis device 1 of the first embodiment.
  • the analysis target function is analyzed in order from the analysis target function included in the upper module to the analysis target function included in the lower module. Therefore, it is suppressed that the analysis target function included in the lower module is analyzed at the stage when the input given to the analysis target function included in the lower module is not determined from the analysis target function included in the upper module. It is possible to wait for the analysis of the analysis target function included in the lower module until the input is determined, and after the input is determined, the analysis target function included in the lower module must be analyzed again. It is possible to prevent the module from disappearing. As a result, the time required for the analysis of the modified source code 41 can be shortened.
  • FIG. 1 is also a block diagram schematically illustrating the hardware configuration of the source code analysis device according to the fourth embodiment.
  • FIG. 15 is a block diagram schematically illustrating the functional configuration of the source code analysis device according to the fourth embodiment.
  • the source code analysis device 4 of the fourth embodiment shown in FIG. 15 is different from the source code analysis device 1 of the first embodiment shown in FIG. 2 in that it further includes an input value processing specifying unit 59.
  • the input value processing specifying unit 59 specifies the processing performed in the function with respect to the input value input to the function. Further, the input value processing specifying unit 59 limits the range of input values input to the function based on the specified processing. For example, the input value processing specifying unit 59 raises the upper limit of the range of input values input to the function and / or lowers the lower limit of the range of input values input to the function based on the specified processing. Do that.
  • FIG. 16 is a diagram illustrating an example of the modified source code input to the source code analysis device of the fourth embodiment.
  • FIG. 17 is a diagram illustrating an example of range information stored in the source code analysis device of the fourth embodiment.
  • the function funcA calls funcB () having an argument arg1, and funcB () squares the argument arg1 and returns it as a return value.
  • the return value returned by the function funcB when the argument arg1 is a positive value is the return value returned by the function funcB when the argument arg1 is a negative value having the same absolute value as the absolute value of the positive value. It is the same. Therefore, as shown in FIG. 17, in determining the necessity of analysis of the function funcB, even when the range of the argument arg1 input to the function funcB is -5 or more and 5 or less. , The range can be limited to 0 or more and 5 or less according to the process of squaring the argument arg1.
  • 18 and 19 are flowcharts illustrating the flow of processing performed by the source code analysis apparatus of the fourth embodiment.
  • the source code analysis device 4 executes steps S401 to S414 shown in FIGS. 18 and 19.
  • step S401 the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 1.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 1 and the unchanged source code 44 stored in the storage unit 55. Further, the change function extraction processing unit 51 extracts the difference between the changed source code 41 and the changed source code 44. Further, the change function extraction processing unit 51 extracts the change function from the extracted difference. Further, the change function extraction processing unit 51 adds the extracted change function to the analysis target list. Further, the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55.
  • step S404 the analysis processing unit 52 extracts the function included in the analysis target list.
  • step S405 the analysis processing unit 52 analyzes the extracted function.
  • the analysis processing unit 52 extracts the influence function that the analyzed function affects the input from the changed source code 41. Further, the analysis processing unit 52 adds the extracted influence function to the determination target list.
  • the input value processing specifying unit 59 limits the range of the input value input to the function according to the processing performed on the input value input to the function added to the determination target list.
  • step S409 the analysis necessity determination processing unit 53 extracts the function included in the determination target list.
  • step S410 the analysis necessity determination processing unit 53 acquires the range information 71 included in the analysis result 45 stored in the storage unit 55. Further, in the analysis necessity determination processing unit 53, whether the range of the input value input to the function fetched in the changed source code 41 is wider than the range of the input value input to the function fetched in the unchanged source code 44. Judge whether or not. If it is determined that the range of the former input value is wider than the range of the latter input value, step S411 is executed. If it is determined that the range of the former input value is narrower than the range of the latter input value, step S412 is executed.
  • step S411 the analysis necessity determination processing unit 53 adds the extracted function to the analysis target list. As a result, the analysis target function is added to the analysis target list.
  • step S414 the analysis result processing unit 54 acquires the analysis result 45. Further, the analysis result processing unit 54 collectively generates the analysis result 43 of the changed source code by collecting the acquired analysis results 45. Further, the analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • the source code analysis device 4 of the fourth embodiment has the same effect as that of the source code analysis device 1 of the first embodiment.
  • the range of the input value input to the function is limited according to the processing performed on the input value input to the function. Therefore, the time required to analyze the modified source code 41 can be shortened.
  • Embodiment 5 the difference between the source code analysis device of the fifth embodiment and the source code analysis device 1 of the first embodiment will be described. Regarding the points not explained, the same configuration as that adopted in the source code analysis apparatus 1 of the first embodiment is adopted in the source code analysis apparatus of the fifth embodiment.
  • FIG. 1 is also a block diagram schematically illustrating the hardware configuration of the source code analysis device according to the fifth embodiment.
  • FIG. 20 is a block diagram schematically illustrating the functional configuration of the source code analysis device according to the fifth embodiment.
  • the source code analysis device 5 of the fifth embodiment shown in FIG. 20 is the source of the first embodiment shown in FIG. 2 in that the number of analysis layers 48 is further input and the analysis layer designation unit 60 is further provided. It is different from the code analysis device 1.
  • the number of analysis layers 48 indicates the upper limit of the layer difference between the layer to which the change function belongs and the layer to which the analysis target function belongs.
  • the analysis hierarchy designation unit 60 specifies the hierarchy to which the analysis target function belongs.
  • the analysis layer designation unit 60 acquires the number of analysis layers 48 input to the source code analysis device 5, and designates the layer to which the analysis target function belongs according to the acquired number of analysis layers 48.
  • the analysis processing unit 52 analyzes the analysis target function belonging to the designated hierarchy. However, the analysis processing unit 52 does not analyze the functions belonging to the hierarchy other than the designated hierarchy.
  • 21 and 22 are flowcharts illustrating the flow of processing performed by the source code analysis apparatus of the fifth embodiment.
  • the source code analysis device 5 of the fifth embodiment executes steps S501 to S517 shown in FIGS. 21 and 22.
  • step S501 the analysis hierarchy designation unit 60 acquires the number of analysis layers 48 input to the source code analysis device 5.
  • step S502 the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 5.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 5 and the unchanged source code 44 stored in the storage unit 55. Further, the change function extraction processing unit 51 extracts the difference between the changed source code 41 and the changed source code 44. Further, the change function extraction processing unit 51 extracts the change function from the extracted difference. Further, the change function extraction processing unit 51 adds the extracted change function to the analysis target list. Further, the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55.
  • the analysis hierarchy designation unit 60 assigns a number of layers of 0 to the added change function.
  • step S506 the analysis processing unit 52 extracts the function included in the analysis target list.
  • step S507 the analysis processing unit 52 analyzes the extracted function.
  • the analysis processing unit 52 extracts the influence function that the analyzed function affects the input from the changed source code 41. Further, the analysis processing unit 52 adds the extracted influence function to the determination target list.
  • the analysis hierarchy designation unit 60 assigns the number of layers added to the number of layers given to the extracted function to the function to which the number of layers is added.
  • step S511 the analysis necessity determination processing unit 53 extracts the function included in the determination target list.
  • step S512 the analysis necessity determination processing unit 53 determines whether or not the number of layers assigned to the extracted function is equal to or less than the upper limit of the number of layers specified by the analysis layer designation unit 60. If it is determined that the number of layers assigned to the extracted function is equal to or less than the upper limit of the number of layers specified by the analysis layer designation unit 60, step S513 is executed. If the number of layers assigned to the extracted function is larger than the upper limit of the number of layers specified by the analysis layer designation unit 60, step S515 is executed.
  • step S513 the analysis necessity determination processing unit 53 acquires the range information 71 included in the analysis result 45 stored in the storage unit 55. Further, in the analysis necessity determination processing unit 53, whether the range of the input value input to the function fetched in the changed source code 41 is wider than the range of the input value input to the function fetched in the unchanged source code 44. Judge whether or not. If it is determined that the range of the former input value is wider than the range of the latter input value, step S514 is executed. If it is determined that the range of the former input value is narrower than the range of the latter input value, step S515 is executed.
  • step S514 the analysis necessity determination processing unit 53 adds the extracted function to the analysis target list. As a result, the analysis target function is added to the analysis target list.
  • step S517 the analysis result processing unit 54 acquires the analysis result 45. Further, the analysis result processing unit 54 collectively generates the analysis result 43 of the changed source code by collecting the acquired analysis results 45. Further, the analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • the source code analysis device 5 of the fifth embodiment has the same effect as that of the source code analysis device 1 of the first embodiment.
  • the source code analysis device 5 of the fifth embodiment only the functions separated from the change function by the hierarchy difference equal to or less than the upper limit of the hierarchy difference specified by the number of analysis layers 48 are set as the analysis target functions, and the functions are analyzed from the upper limit. Functions that are separated by a large hierarchy are not regarded as analysis target functions, and only analysis target functions that belong to a hierarchy close to the hierarchy to which the change function belongs can be analyzed. As a result, the time required for the analysis of the modified source code 41 can be shortened.
  • FIG. 1 is also a block diagram schematically showing the hardware configuration of the source code analysis device according to the sixth embodiment.
  • FIG. 23 is a block diagram schematically illustrating the functional configuration of the source code analysis device according to the sixth embodiment.
  • the source code analysis device 6 of the sixth embodiment shown in FIG. 23 is a source code of the first embodiment shown in FIG. 2 in that a permissible range 49 is further input and a permissible range designation unit 61 is further provided. It is different from the analyzer 1.
  • the input allowable range 49 indicates the allowable range of the input value input to the function included in the change function and the influence function.
  • the permissible range designation unit 61 designates a permissible range indicating the permissible range of the input value input to the function included in the change function and the influence function.
  • the permissible range designation unit 61 acquires the permissible range 49 input to the source code analysis device 6, and designates the permissible range according to the acquired permissible range 49.
  • the range of the input value input to the function included in the change function and the influence function is indicated by the specified allowable value range, and the allowable range of the input value input to the function is indicated. If it is narrower, it is determined that the function is not the function to be analyzed, and the range of input values input to the function is the allowable range of input values input to the function, which is indicated by the specified allowable value range. If it is wider, it is determined that the function is the function to be analyzed.
  • the allowable range 49 indicating the range is known. Can be input to the source code analysis device 6 to reduce the number of functions to be analyzed.
  • 24 and 25 are flowcharts illustrating the flow of processing performed by the source code analysis apparatus of the sixth embodiment.
  • the source code analysis device 6 executes steps S601 to S616 shown in FIGS. 24 and 25.
  • step S601 the permissible range designation unit 61 acquires the permissible range 49 input to the source code analysis device 6.
  • step S602 the analysis processing unit 52 acquires the analysis result 42 of the unchanged source code input to the source code analysis device 1.
  • the change function extraction processing unit 51 acquires the changed source code 41 input to the source code analysis device 1 and the unchanged source code 44 stored in the storage unit 55. Further, the change function extraction processing unit 51 extracts the difference between the changed source code 41 and the changed source code 44. Further, the change function extraction processing unit 51 extracts the change function from the extracted difference. Further, the change function extraction processing unit 51 adds the extracted change function to the analysis target list. Further, the change function extraction processing unit 51 stores the acquired changed source code 41 in the storage unit 55.
  • the permissible range designation unit 61 assigns a permissible range to the added function according to the acquired permissible range 49.
  • step S606 the analysis processing unit 52 extracts the function included in the analysis target list.
  • step S607 the analysis processing unit 52 analyzes the extracted function.
  • the analysis processing unit 52 extracts the influence function that the analyzed function affects the input from the changed source code 41. Further, the analysis processing unit 52 adds the extracted influence function to the determination target list.
  • the permissible range designation unit 61 assigns a permissible range to the added function according to the acquired permissible range 49.
  • step S611 the analysis necessity determination processing unit 53 extracts the function included in the determination target list.
  • step S612 the analysis necessity determination processing unit 53 acquires the range information 71 included in the analysis result 45 stored in the storage unit 55. Further, in the analysis necessity determination processing unit 53, whether the range of the input value input to the function fetched in the changed source code 41 is wider than the range of the input value input to the function fetched in the unchanged source code 44. Judge whether or not. If it is determined that the range of the former input value is wider than the range of the latter input value, step S613 is executed. If it is determined that the range of the former input value is narrower than the range of the latter input value, step S615 is executed.
  • step S613 the analysis necessity determination processing unit 53 determines whether or not the range of the input value input to the extracted function is not within the permissible range of the input value input to the function. .. If it is determined that the range of the former input value does not fall within the range of the latter input value, step S614 is executed. If it is determined that the range of the former input value is within the range of the latter input value, step S615 is executed.
  • step S614 the analysis necessity determination processing unit 53 adds the extracted function to the analysis target list. As a result, the analysis target function is added to the analysis target list.
  • step S616 the analysis result processing unit 54 acquires the analysis result 45. Further, the analysis result processing unit 54 collectively generates the analysis result 43 of the changed source code by collecting the acquired analysis results 45. Further, the analysis result processing unit 54 outputs the analysis result 43 of the generated modified source code.
  • the source code analysis device 6 of the sixth embodiment has the same effect as that of the source code analysis device 1 of the first embodiment.
  • the range of possible values of the input values input to the change function and the function included in the influence function is set in advance when the source code 41 is set after the change. If it is known, the number of functions to be analyzed can be reduced by inputting the allowable value range 49 indicating the range into the source code analysis device 6. As a result, the time required to analyze the modified source code 41 can be shortened.
  • each embodiment can be freely combined, and each embodiment can be appropriately modified or omitted within the scope of the invention.
  • 1,2,3,4,5,6 source code analysis device 51 change function extraction processing unit, 52 analysis processing unit, 53 analysis necessity judgment processing unit, 54 analysis result processing unit, 56 verified information storage processing unit, 57 Hierarchical specification processing unit, 58 Analysis order specification unit, 59 Input value processing specific unit, 60 Analysis hierarchy specification unit, 61 Allowable range specification unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

動的解析手法によりソースコードを解析するソースコード解析装置において、ソースコードを解析するのに要する時間を、解析精度を下げることなく、短くする。ソースコード解析装置は、変更関数抽出処理部、解析処理部、解析要否判定処理部及び解析結果処理部を備える。変更関数抽出処理部は、変更後ソースコードに含まれる、変更前ソースコードからの変更箇所に含まれる変更関数を抽出する。解析処理部は、変更関数により入力を与えられる影響関数を変更後ソースコードから抽出する。解析要否判定処理部は、変更関数及び影響関数に含まれる関数に入力される入力値の範囲に基づいて関数が解析対象関数であるか否か判定する。解析処理部は、変更関数及び影響関数に含まれる、解析要否判定処理部により解析を要すると判定された解析対象関数の解析を行う。解析結果処理部は、解析対象関数の解析結果を含む、変更後ソースコードの解析結果を出力する。

Description

ソースコード解析装置
 本発明は、ソースコード解析装置に関する。
 ソフトウェアのソースコードを解析する手法は、静的解析手法及び動的解析手法に大別される。
 静的解析手法は、ソースコードの静的構造を解析してソフトウェアの不具合の有無を検出する。
 動的解析手法は、ソースコードに含まれる関数ごとに関数の引数、関数の戻り値、グローバル変数等の入力値の全ての組み合わせについて不具合の有無を網羅的に検出することにより、ソフトウェアの不具合の有無を検出する。動的解析手法は、演算桁溢れ等の静的解析手法が検出することができない不具合を検出することができる。動的解析手法は、MathWorks社製のPolyspace(登録商標)等において採用されている。
 近年においては、パーソナルコンピュータ(PC)の性能が向上するのに伴って、動的解析手法によりソフトウェアの不具合が検出されるようになってきている。
 一方、ソフトウェアの開発プロジェクトにおいては、ソースコードが変更されるごとにソースコードを解析してソースコードの変更の影響、ソースコードの変更により生じたソフトウェアの不具合等を検出することが期待されている。
 特許文献1に記載された技術は、ソースコードの検証に関する(発明の名称)。特許文献1に記載された技術においては、関数に対する条件及び変数に対する条件のいずれかが変更されたことが検知された場合に、変更された条件を直接うける関数及びその関数を直接呼び出す関数が、検証が必要な関数群における基点関数として検出される(段落0015)。
 特許文献2に記載された技術は、ソフトウェアの検査に関する(発明の名称)。特許文献2に記載された技術においては、制約条件付き非線形計画法の問題を解く為に用いられるソルバにより、所与の制約条件及び変数値に対する値域制約の下で、制約条件式を充足する解の有無が判定される(段落0007)。
 特許文献3に記載された技術は、アプリケーションの解析に関する(発明の名称)。特許文献3に記載された技術においては、入力データ項目の値域の変更にともなうプログラムの修正内容が想定要件情報に基づいて値域に対応させられて見積もられる(段落0017)。
特開2008-191963号公報 国際公開第2016/121074号 国際公開第2009/011057号
 ソフトウェアの開発プロジェクトが大規模プロジェクトである場合は、膨大な量のソースコードが作成される。このため、作成されたソースコードが動的解析手法により解析される場合は、入力値の組み合わせの数が増加し、作成されたソースコードを解析するのに要する時間が長くなる。このため、ソフトウェアの開発プロジェクトが大規模プロジェクトである場合は、作成されたソースコードを動的解析手法により解析する環境を構築することが困難となる。
 本発明は、この問題に鑑みてなされた。本発明は、動的解析手法によりソースコードを解析するソースコード解析装置において、ソースコードを解析するのに要する時間を、解析精度を下げることなく、短くすることを目的とする。
 本発明は、ソースコード解析装置に関する。
 ソースコード解析装置は、変更関数抽出処理部、解析処理部、解析要否判定処理部及び解析結果処理部を備える。
 変更関数抽出処理部は、変更後ソースコードに含まれる、変更前ソースコードからの変更箇所に含まれる変更関数を抽出する。
 解析要否判定処理部は、変更関数及び影響関数に含まれる関数に入力される入力値の範囲に基づいて関数が解析対象関数であるか否か判定する。
 解析処理部は、解析要否判定処理部により解析を要すると判定された解析対象関数の解析を行う。
 解析結果処理部は、解析対象関数の解析結果を含む、変更後ソースコードの解析結果を出力する。
 本発明によれば、解析が行われる解析対象関数が、変更後ソースコードに含まれる、変更前ソースコードからの変更箇所に含まれる変更関数、及び変更関数により入力を与えられる影響関数に制限される。このため、変更後ソースコードを解析するのに要する時間を短くすることができる。
 また、本発明によれば、解析が行われる解析対象関数が、関数に入力される入力値の範囲に基づいてさらに制限される。このため、変更後ソースコードを解析するのに要する時間をさらに短くすることができる。
 また、本発明においては、変更前ソースコードの解析結果を用いて、変更後ソースコードに含まれる全ての関数の解析が行われた場合に出力される変更後ソースコードの解析結果と同様の変更後ソースコードの解析結果を出力することができる。したがって、変更後ソースコードを解析するのに要する時間を、解析の精度を下げることなく、短くすることができる。
 本発明の目的、特徴、局面及び利点は、以下の詳細な説明と添付図面とによって、より明白となる。
実施の形態1-6のソースコード解析装置のハードウェア構成を模式的に図示するブロック図である。 実施の形態1のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態1のソースコード解析装置に格納される値域情報の例を示すテーブルである。 実施の形態1のソースコード解析装置に格納される判定情報の例を示すテーブルである。 実施の形態1のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態1のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態2のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態2のソースコード解析装置に格納される値域情報の例を示すテーブルである。 実施の形態2のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態3のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態1のソースコード解析装置に入力されるソフトウェア階層情報により示される階層構造の例を示すツリーである。 実施の形態1のソースコード解析装置に入力されるソフトウェア階層情報により示される階層構造に含まれる関数に付与される階層番号の例を示すテーブルである。 実施の形態3のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態3のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態4のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態4のソースコード解析装置に入力される変更後ソースコードの例を図示する図である。 実施の形態4のソースコード解析装置に格納される値域情報の例を図示する図である。 実施の形態4のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態4のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態5のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態5のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態5のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態6のソースコード解析装置の機能構成を模式的に図示するブロック図である。 実施の形態6のソースコード解析装置が行う処理の流れを図示するフローチャートである。 実施の形態6のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 1 実施の形態1
 1.1 ハードウェア構成
 図1は、実施の形態1のソースコード解析装置のハードウェア構成を模式的に図示するブロック図である。
 図1に図示されるソースコード解析装置1は、ソースコード解析プログラム21がインストールされたパーソナルコンピューター(PC)である。
 ソースコード解析装置1は、図1に図示されるように、プロセッサ11、メモリ12及びストレージ13を備える。
 ストレージ13には、ソースコード解析プログラム21がインストールされる。ソースコード解析プログラム21のインストールは、外部記録媒体31から読み出したソースコード解析プログラム21をストレージ13に書き込むことにより行われてもよいし、ネットワーク32を経由して受信したソースコード解析プログラム21をストレージ13に書き込むことにより行われてもよい。
 プロセッサ11は、中央処理装置(CPU)、グラフィックス処理装置(GPU)、デジタル信号処理装置(DSP)等である。メモリ12は、ランダムアクセスメモリ(RAM)等である。ストレージ13は、ハードディスクドライブ、ソリッドステートドライブ、RAMディスク等である。外部記録媒体31は、コンパクトディスク(CD)、デジタル多目的ディスク(DVD)、ブルーレイディスク(BD)、ユニバーサルシリアルバス(USB)メモリ等である。
 メモリ12、ストレージ13及び外部記録媒体31は、ソースコード解析プログラム21を記録した非一時的でコンピュータ読み取り可能な記録媒体である。
 ソースコード解析装置1においては、ストレージ13にインストールされたソースコード解析プログラム21がメモリ12にロードされ、ロードされたソースコード解析プログラム21がプロセッサ11により実行されることにより、PCがソースコード解析装置1として機能する。
 1.2 機能構成
 図2は、実施の形態1のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図2に図示されるソースコード解析装置1は、動的解析手法によりソースコードを解析する。
 ソースコード解析装置1には、図2に図示されるように、変更後ソースコード41、及び変更前ソースコードの解析結果42が入力される。ソースコード解析装置1は、入力された変更前ソースコードの解析結果42を用いて変更後ソースコード41を解析することにより変更後ソースコードの解析結果43を生成し、生成した変更後ソースコードの解析結果43を出力する。入力される変更後ソースコード41、及び変更前ソースコードの解析結果42、並びに出力される変更後ソースコードの解析結果43は、ファイルである。
 ソースコード解析装置1は、図2に図示されるように、変更関数抽出処理部51、解析処理部52、解析要否判定処理部53、解析結果処理部54及び格納部55を備える。格納部55が、ソースコード解析装置1の外部に設けられてもよい。
 変更関数抽出処理部51、解析処理部52、解析要否判定処理部53及び解析結果処理部54は、プロセッサ11がソースコード解析プログラム21を実行することにより構成される。変更関数抽出処理部51、解析処理部52、解析要否判定処理部53及び解析結果処理部54の全部又は一部がプログラムを実行しないハードウェアにより構成されてもよい。格納部55は、メモリ12及びストレージ13の少なくとも一方により構成される。
 格納部55は、図2に図示されるように、変更前ソースコード44及び解析結果45を格納する。解析結果45は、図2に図示されるように、値域情報71及び判定情報72を含む。
 解析結果45は、変更前ソースコードの解析結果42を展開し、展開した解析結果を更新することにより生成される。値域情報71は、関数に入力される入力値の範囲を示す。判定情報72は、解析対象関数に含まれる各行において不具合が発生するか否かを判定した結果を示す。不具合が発生するか否かを判定した結果は、例えば「安全」、「危険」又は「条件によっては危険」である。「安全」は、不具合が発生しないことを示す。「危険」は、確実に不具合が発生することを示す。「条件によっては危険」は、条件によっては不具合が発生することを示す。
 変更関数抽出処理部51は、ソースコード解析装置1に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。
 また、変更関数抽出処理部51は、取得した変更後ソースコード41に含まれる、取得した変更前ソースコード44からの変更箇所に含まれる変更関数を抽出する。変更関数抽出処理部51は、変更関数を抽出する際に、変更後ソースコード41と変更前ソースコード44との差分を抽出する。抽出された差分は、変更前ソースコード44に含まれる関数及びグローバル変数からそれぞれ変更された関数及びグローバル変数、並びに変更前ソースコード44に追加された関数及びグローバル変数の情報を含む。変更関数抽出処理部51は、当該情報を参照して、抽出した差分から変更関数を抽出する。抽出される変更関数は、変更前ソースコード44に含まれる関数から変更された関数、及び変更前ソースコード44に追加された関数である。
 また、変更関数抽出処理部51は、当該差分を抽出した後に、取得した変更後ソースコード41を格納部55に格納する。格納された変更後ソースコード41は、ソースコード解析装置1に次に入力される変更後ソースコード41が解析される際に変更前ソースコード44として用いられる。
 解析処理部52は、変更関数抽出処理部51により抽出された変更関数を取得する。
 また、解析処理部52は、取得した変更関数により入力を与えられる影響関数を変更後ソースコード41から抽出する。変更関数が影響関数に入力を与える場合は、影響関数に入力値が入力される。抽出される影響関数及びそれに入力される入力値は、変更関数の変更の影響を受ける。
 関数funcA()が引数arg1を有する関数funcB(arg1)を呼び出す場合は、関数funcA()が関数funcB(arg1)に入力を与え、引数arg1が関数funcB(arg1)に入力される入力値である。
 戻り値を返す関数funcB()が関数funcA()から呼び出される場合は、関数funcB()が関数funcA()に入力を与え、戻り値が関数funcA()に入力される入力値である。
 関数funcA()がグローバル変数g_val_Aを書き換え、関数funcB(arg1)がグローバル変数g_val_Aを読み取る場合は、関数funcA()が関数funcB(arg1)に入力を与え、グローバル変数g_val_Aが関数funcB(arg1)に入力される入力値である。
 解析要否判定処理部53は、変更関数抽出処理部51により抽出された変更関数、解析処理部52により抽出された影響関数、及び格納部55に格納された解析結果45に含まれる値域情報71を取得する。
 また、解析要否判定処理部53は、取得した変更関数及び影響関数に含まれる関数が解析対象関数であるか否かを判定する。解析要否判定処理部53は、関数が解析対象関数であるか否かを判定する際に、当該関数に入力される入力値の範囲に基づいて当該関数が解析対象関数であるか否かを判定する。実施の形態1においては、解析要否判定処理部53は、変更後ソースコード41において当該関数に入力される入力値の範囲が、変更前ソースコード44において当該関数に入力される入力値の範囲より狭い場合は、当該関数が解析対象関数でないと判定し、変更後ソースコード41において当該関数に入力される入力値の範囲が、変更前ソースコード44において当該関数に入力される入力値の範囲より広い場合は、当該関数が解析対象関数であると判定する。
 当該関数に入力される入力値は、当該関数の引数、当該関数により呼び出される他の関数が返す戻り値、及び当該関数により読み取られるグローバル変数からなる群より選択される少なくともひとつを含む。
 引数の範囲は、当該引数を有する関数が呼び出された場合に当該関数に与えられる引数を解析することにより、決定される。戻り値の範囲は、関数の全体を解析することにより、決定される。グローバル変数の範囲は、当該グローバル変数を書き換える関数を解析することにより、決定される。
 また、解析要否判定処理部53は、当該変数が解析対象関数であるか否かを判定した結果を解析処理部52に通知する。これにより、解析処理部52は、解析要否判定処理部53により解析を要すると判定された解析対象関数の解析を行うことができる。
 解析処理部52は、取得した変更関数及び抽出した影響関数に含まれる、解析要否判定処理部53により解析を要すると判定された解析対象関数の解析を行う。しかし、解析処理部52は、上述した影響関数を抽出する処理を除いて、解析対象関数以外の関数の解析を必ずしも行う必要はない。このため、実施の形態1においては、解析処理部52は、上述した影響関数を抽出する処理を除いて、解析対象関数以外の関数の解析を行わない。解析対象関数の解析は、解析対象関数に含まれる各行において不具合が発生するか否かを判定することを含む。解析処理部52は、解析対象関数の解析において、解析対象関数に入力される入力値を振って検証を行う。不具合が発生するか否かを判定した結果は、例えば「安全」、「危険」又は「条件によっては危険」である。
 また、解析処理部52は、ソースコード解析装置1に入力された変更前ソースコードの解析結果42を取得する。
 また、解析処理部52は、取得した変更前ソースコードの解析結果42を展開して解析結果を生成する。また、解析処理部52は、更新した解析結果45が解析対象関数の解析結果を含むように、生成した解析結果を更新する。また、解析処理部52は、更新した解析結果45を格納部55に格納する。解析処理部52は、解析結果45を更新する際に、値域情報71及び判定情報72を解析結果45に含める。
 解析結果処理部54は、格納された解析結果45を取得する。
 また、解析結果処理部54は、取得した解析結果45に基づいて変更後ソースコードの解析結果43を生成する。生成される変更後ソースコードの解析結果43は、解析対象関数の解析結果を含む。
 また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 1.3 値域情報の例
 図3は、実施の形態1のソースコード解析装置に格納される値域情報の例を示すテーブルである。
 値域情報71は、図3に図示されるように、複数の要素81を含む。
 複数の要素81に含まれる各要素は、図3に図示されるように、識別子(ID)、関数名、変数名、入力種別、上限値及び下限値を含む。
 IDは、各要素に付与された番号を示す。各要素に付与された番号は、各要素に固有の番号である。
 関数名は、各要素が対象とする関数の関数名を示す。
 変数名は、各要素が対象とする関数に入力される入力値が入れられる変数の変数名を示す。
 入力種別は、各要素が対象とする関数に入力される入力値の種別を示す。入力種別は、引数、戻り値又はグローバル変数である。入力種別が戻り値である場合は、入力種別は、当該戻り値を返す関数の関数名も示す。
 上限値及び下限値は、それぞれ各要素が対象とする関数に入力される入力値の範囲の上限値及び下限値を示す。上限値及び下限値は、解析処理部52が、関数に入力される入力値の範囲を決定することにより決定される。
 値域情報71は、0,1,2及び3というIDが付与された要素を含む。0及び1というIDが付与された要素は、関数funcAの引数arg1及びarg2が関数funcAに入力され、引数arg1が、0以上10以下の値域を有し、引数arg2が、-5以上5以下の値域を有することを示す。2というIDが付与された要素は、関数funcCが返す戻り値retValが関数funcBに入力され、戻り値retValが、1以上100以下の値域を有することを示す。3というIDが付与された要素は、グローバル変数g_valが関数funcCに入力され、グローバル変数g_valが、0以上5以下の値域を有することを示す。
 1.4 判定情報の例
 図4は、実施の形態1のソースコード解析装置に格納される判定情報の例を示すテーブルである。
 判定情報72は、図4に図示されるように、複数の要素91を含む。
 複数の要素91に含まれる各要素は、図4に図示されるように、ID、ファイルパス、関数名、行数、判定、不具合発生値及び不具合内容を含む。
 IDは、各要素に付与された番号を示す。各要素に付与された番号は、各要素に固有の番号である。
 ファイルパスは、各要素が対象とする判定が行われた行を含むファイルのファイルパスを示す。
 関数名は、各要素が対象とする判定が行われた行を含む関数の関数名を示す。
 行数は、各要素が対象とする判定が行われた行の行数を示す。
 判定は、各要素が対象とする判定の結果を示す。判定の結果は、例えば「安全」、「危険」又は「条件によっては危険」である。
 不具合発生値は、各要素が対象とする判定の結果が「危険」又は「条件によっては危険」である場合に、危険であると判定された入力値が入れられる変数名、及び危険であると判定された入力値の範囲を示す。
 不具合内容は、各要素が対象とする判定の結果が「危険」又は「条件によっては危険」である場合に、発生する不具合の内容を示す。
 図4に図示される判定情報72は、0,1,2及び3というIDが付与された要素を含む。0,1,2及び3というIDが付与された要素は、prj/mod1/src.cというファイルパスを有するファイルに含まれる行の判定が行われたことを示す。0というIDが付与された要素は、関数funcAに含まれる第10行目において不具合が発生しないことを示す。1というIDが付与された要素は、関数funcAに含まれる第11行目において不具合が発生しないことを示す。2というIDが付与された要素は、関数funcBに含まれる第21行目において入力値argが5以上10以下である場合に桁溢れの不具合が発生することを示す。3というIDが付与された要素は、関数funcBに含まれる第22行目において不具合が発生しないことを示す。
 1.5 ソースコード解析装置が行う処理
 図5及び図6は、実施の形態1のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 ソースコード解析装置1は、ソースコード解析装置1が過去にソースコードを解析しており、格納部55が変更前ソースコード44を格納しており、変更前ソースコードの解析結果42が存在している状況下において、図5及び図6に図示されるステップS101からS113までを実行する。
 ステップS101においては、解析処理部52が、ソースコード解析装置1に入力された変更前ソースコードの解析結果42を取得する。
 続くステップS102においては、変更関数抽出処理部51が、ソースコード解析装置1に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。また、変更関数抽出処理部51は、変更後ソースコード41と変更前ソースコード44との差分を抽出する。また、変更関数抽出処理部51は、抽出した差分から変更関数を抽出する。また、変更関数抽出処理部51は、抽出した変更関数を解析対象リストに追加する。また、変更関数抽出処理部51は、取得した変更後ソースコード41を格納部55に格納する。
 続くステップS103からS112までの解析対象リストループにおいては、解析対象リストに含まれる全ての関数についてステップS104からS111までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS104においては、解析処理部52が、解析対象リストに含まれる関数を取り出す。
 続くステップS105においては、解析処理部52が、取り出した関数の解析を行う。
 続くステップS106においては、解析処理部52が、解析を行った関数が入力に影響を与える影響関数を変更後ソースコード41から抽出する。抽出される影響関数は、ひとつの関数である場合もあるし、複数の関数である場合もある。また、解析処理部52は、抽出した影響関数を判定対象リストに追加する。
 続くステップS107からS111までの判定対象リストループにおいては、判定対象リストに含まれる全ての関数についてステップS108からS110までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS108においては、解析要否判定処理部53が、判定対象リストに含まれる関数を取り出す。
 続くステップS109においては、解析要否判定処理部53が、格納部55に格納された解析結果45に含まれる値域情報71を取得する。また、解析要否判定処理部53は、変更後ソースコード41において取り出した関数に入力される入力値の範囲が、変更前ソースコード44において取り出した関数に入力される入力値の範囲より広いか否かを判定する。前者の入力値の範囲が後者の入力値の範囲より広いと判定された場合は、ステップS110が実行される。前者の入力値の範囲が後者の入力値の範囲より狭いと判定された場合は、ステップS111が実行される。これにより、取り出された関数が解析対象関数であるか否かが判定される。
 ステップS110においては、解析要否判定処理部53が、取り出した関数を解析対象リストに追加する。これにより、解析対象リストに解析対象関数が追加される。
 ステップS113においては、解析結果処理部54が、解析結果45を取得する。また、解析結果処理部54は、取得した解析結果45をまとめて変更後ソースコードの解析結果43を生成する。また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 1.6 実施の形態1の発明の効果
 実施の形態1の発明によれば、解析が行われる解析対象関数が、変更後ソースコード41に含まれる、変更前ソースコード44からの変更箇所に含まれる変更関数、及び変更関数により入力を与えられる影響関数に制限される。このため、変更後ソースコード41を解析するのに要する時間を短くすることができる。
 また、実施の形態1の発明によれば、解析が行われる解析対象関数が、関数に入力される入力値の範囲に基づいてさらに制限される。このため、変更後ソースコード41を解析するのに要する時間をさらに短くすることができる。
 また、実施の形態1の発明においては、変更前ソースコードの解析結果42を用いて、変更後ソースコード41に含まれる全ての関数の解析が行われた場合に出力される変更後ソースコードの解析結果と同様の変更後ソースコードの解析結果43を出力することができる。したがって、変更後ソースコード41を解析するのに要する時間を、解析の精度を下げることなく、短くすることができる。
 2 実施の形態2
 以下では、実施の形態2のソースコード解析装置が実施の形態1のソースコード解析装置1と異なる点が説明される。説明されない点については、実施の形態1のソースコード解析装置1において採用される構成と同様の構成が実施の形態2のソースコード解析装置においても採用される。
 図1は、実施の形態2のソースコード解析装置のハードウェア構成を模式的に図示するブロック図でもある。
 図7は、実施の形態2のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図7に図示される実施の形態2のソースコード解析装置2は、検証済情報格納処理部56をさらに備える点で、図2に図示される実施の形態1のソースコード解析装置1と異なる。
 検証済情報格納処理部56は、解析処理部52により検証が行われた値を示す検証済情報を格納部55に格納する。格納される検証済情報は、値域情報71に含められる。実施の形態2においては、値域情報71に含められる検証済情報は、検証が行われた値の範囲を示す検証済値域である。
 解析処理部52は、解析対象関数の解析において、解析処理部52により検証が既に行われている場合は、検証済情報により示される検証が行われた値以外について解析対象関数に入力される入力値を振って検証を行う。これにより、解析処理部52は、検証が行われていない値について解析対象関数に入力される入力値を振って新たな検証を行う。これにより、変更後ソースコード41を解析するのに要する時間をさらに短くすることができる。
 図8は、実施の形態2のソースコード解析装置に格納される値域情報の例を示すテーブルである。
 図8に図示される値域情報71は、検証済値域を含む点で、図3に図示される値域情報71と異なる。
 検証済値域は、各要素が対象とする関数に入力される入力値の検証が行われた範囲を示す。検証済値域は、解析処理部52により検証が行われた後に検証済情報格納処理部56により更新される。
 0というIDが付与された要素は、引数arg1については0以上5以下の範囲において検証が既に行われていることを示す。したがって、解析処理部52は、当該検証が行われた後は、0より小さい値、又は5より大きい値について、検証を行う。1というIDが付与された要素は、引数arg2については-5以上5以下の範囲において検証が既に行われていることを示す。したがって、解析処理部52は、当該検証が行われた後は、-5より小さい値、又は5より大きい値について、検証を行う。2というIDが付与された要素は、戻り値retValについては1以上50以下の範囲において検証が既に行われていることを示す。したがって、解析処理部52は、当該検証が行われた後は、1より小さい値、又は50より大きい値について、検証を行う。3というIDが付与された要素は、グローバル変数g_valについては0以上5以下の範囲において検証が既に行われていることを示す。したがって、解析処理部52は、当該検証が行われた後は、0より小さい値、又は5より大きい値について、検証を行う。
 図9は、実施の形態2のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 ソースコード解析装置2は、図9に図示されるステップS201からS208までを実行する。
 ステップS201においては、解析処理部52が、格納部55に格納されている値域情報71に含まれる検証済値域を取得する。
 続くステップS202においては、解析処理部52が、格納部55に格納されている値域情報71に含まれる値域を取得する。
 続くステップS203からS207までの値域ループにおいては、値域の範囲内のすべての検証値についてステップS204からS206までの処理が実行されるまで、当該処理が繰り返し実行される。検証値は、当該処理が実行されるごとに、値域の下限値から値域の上限値に向かって増加させられる。
 ステップS204においては、解析処理部52が、検証値が、取得した検証済値域により示される範囲外であるか否かを判定する。検証値が、取得した検証済値域の範囲外であると判定された場合は、ステップS205が実行される。検証値が、取得した検証済値域により示される範囲内であると判定された場合は、ステップS207が実行される。
 ステップS205においては、解析処理部52が、検証値について解析対象関数の検証を行う。検証は、解析対象関数に含まれる全ての行に対して行われる。
 続くステップS206においては、検証済情報格納処理部56が、格納部55に格納されている値域情報71に含まれる検証済値域により示される範囲が検証値を含むように当該検証済値域を更新する。これにより、当該検証済値域の下限値又は上限値が更新される。
 ステップS208においては、解析処理部52が、解析結果45を更新する。
 実施の形態2のソースコード解析装置2は、実施の形態1のソースコード解析装置1の効果と同様の効果を有する。
 加えて、実施の形態2のソースコード解析装置2によれば、検証が行われた値について再び検証を行うことを抑制することができる。このため、変更後ソースコード41を解析するのに要する時間を短くすることができる。
 3 実施の形態3
 以下では、実施の形態3のソースコード解析装置が実施の形態1のソースコード解析装置1と異なる点が説明される。説明されない点については、実施の形態1のソースコード解析装置1において採用される構成と同様の構成が実施の形態3のソースコード解析装置においても採用される。
 図1は、実施の形態3のソースコード解析装置のハードウェア構成を模式的に図示するブロック図でもある。
 図10は、実施の形態3のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図10に図示される実施の形態3のソースコード解析装置3は、ソフトウェア階層情報46がさらに入力され、階層特定処理部57及び解析順序指定部58をさらに備え、ソフトウェア階層情報47が格納部55にさらに格納される点で、図2に図示される実施の形態1のソースコード解析装置1と異なる。入力されるソフトウェア階層情報46は、ファイルである。
 ソフトウェア階層情報46は、変更後ソースコード41に含まれる関数の階層構造を示す。ソフトウェア階層情報47は、変更後ソースコード41に含まれる関数のコールツリーを示す。コールツリーは、当該関数の呼び出し順序を示す。したがって、ソフトウェア階層情報47を参照することにより、ソフトウェアの上位モジュールに含まれる関数とソフトウェアの下位モジュールに含まれる関数とを区別することができる。
 階層特定処理部57は、ソースコード解析装置3に入力されたソフトウェア階層情報46を取得する。
 また、階層特定処理部57は、取得したソフトウェア階層情報46により示される、変更後ソースコード41に含まれる関数の階層構造から、変更後ソースコード41に含まれる関数のコールツリーを示すソフトウェア階層情報47を生成する。これにより、階層特定処理部57は、変更後ソースコード41に含まれる関数の階層構造において解析対象関数が属する階層を特定することができる。
 また、階層特定処理部57は、生成したソフトウェア階層情報47を格納部55に格納する。
 解析順序指定部58は、解析対象関数の解析順序を指定する。指定される解析対象関数の解析順序は、当該解析対象関数の解析の優先度を示す。したがって、解析対象関数の解析順序が指定された場合は、解析処理部52は、高い解析の優先度を有する解析対象関数から低い解析の優先度を有する解析対象関数へ解析対象関数の解析順序順に解析対象関数の解析を行う。
 解析順序指定部58により指定される解析対象関数の解析順序は、階層特定処理部57により特定される、変更後ソースコード41に含まれる関数の階層構造において解析対象関数が属する階層が高くなるほど先になる。
 解析処理部52は、指定された解析対象関数の解析順序順に解析対象関数の解析を行う。これにより、解析処理部52は、上位のモジュールに含まれる解析対象関数から下位のモジュールに含まれる解析対象関数に順に解析対象関数の解析を行う。また、解析処理部52は、解析対象関数の呼び出し順に解析対象関数の解析を行う。
 図11は、実施の形態1のソースコード解析装置に入力されるソフトウェア階層情報により示される階層構造の例を示すツリーである。図12は、実施の形態1のソースコード解析装置に入力されるソフトウェア階層情報により示される階層構造に含まれる関数に付与される階層番号の例を示すテーブルである。
 図11に図示されるツリー101は、ソフトウェア階層情報46により示される階層構造が、関数funcA,funcB,funcC,funcD,funcE及びfuncFを含むことを示す。また、ツリー101は、関数funcAが、関数funcB及びfuncCが属する階層よりひとつ上の階層に属することを示す。また、ツリー101は、関数funcBが、関数funcD及びfuncEが属する階層よりひとつ上の階層に属することを示す。また、ツリー101は、関数funcCが、関数funcFが属する階層よりひとつ上の階層に属することを示す。
 ソフトウェア階層情報46がツリー101により示される階層構造を有する場合は、図12に図示されるテーブル111により示されるように、上位の階層に属する関数funcA、中位の階層に属する関数funcB及びfuncC、並びに下位の階層に属する関数funcD,funcE及びfuncFの順に階層番号が付与され、関数funcA,funcB,funcC,funcD,funcE及びfuncFに、それぞれ階層番号0,1,2,3,4及び5が付与される。関数に付与される階層番号が若いことは、当該関数の解析の優先度が高いことを示す。
 図13及び図14は、実施の形態3のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 ソースコード解析装置3は、図13及び図14に図示されるステップS301からS315までを実行する。
 ステップS301においては、解析処理部52が、ソースコード解析装置3に入力された変更前ソースコードの解析結果42を取得する。
 続くステップS302においては、階層特定処理部57が、ソースコード解析装置3に入力されたソフトウェア階層情報46を取得する。また、階層特定処理部57は、取得したソフトウェア階層情報46から階層構造を抽出する。また、階層特定処理部57は、上位の階層に属する関数から順に階層構造に含まれる関数に階層番号を付与する。
 続くステップS303においては、変更関数抽出処理部51が、ソースコード解析装置3に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。また、変更関数抽出処理部51は、取得した変更後ソースコード41と取得した変更前ソースコード44との差分を抽出する。また、変更関数抽出処理部51は、抽出した差分から変更関数を抽出する。また、変更関数抽出処理部51は、取得した変更後ソースコード41を格納部55に格納する。
 ステップS304においては、変更関数抽出処理部51が、抽出した変更関数及びそれに付与されている階層番号を解析対象リストに追加する。
 続くステップS305からS314までの解析対象リストループにおいては、解析対象リストに含まれる全ての関数についてステップS306からS313までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS306においては、解析処理部52が、解析対象リストに含まれる関数を取り出す。解析処理部52は、最も若い階層番号が付与されている関数を取り出す。これにより、高い階層に属する解析対象関数から順に解析対象関数の解析が行われる。
 ステップS307においては、解析処理部52が、取り出した関数の解析を行う。
 ステップS308においては、解析処理部52が、解析を行った関数が入力に影響を与える影響関数を変更後ソースコード41から抽出する。また、解析処理部52は、抽出した影響関数を判定対象リストに追加する。
 続くステップS309からS313までの判定対象リストループにおいては、判定対象リストに含まれる全ての関数についてステップS310からS312までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS310においては、解析要否判定処理部53が、判定対象リストに含まれる関数を取り出す。
 続くステップS311においては、解析要否判定処理部53が、格納部55に格納された解析結果45に含まれる値域情報71を取得する。また、解析要否判定処理部53は、変更後ソースコード41において取り出した関数に入力される入力値の範囲が、変更前ソースコード44において取り出した関数に入力される入力値の範囲より広いか否かを判定する。前者の入力値の範囲が後者の入力値の範囲より広いと判定された場合は、ステップS312が実行される。前者の入力値の範囲が後者の入力値の範囲より狭いと判定された場合は、ステップS313が実行される。
 ステップS312においては、解析要否判定処理部53が、取り出した関数及びそれに付与されている階層番号を解析対象リストに追加する。これにより、解析対象リストに解析対象関数及びその解析の優先度を示す階層番号が追加される。
 ステップS315においては、解析結果処理部54が、解析結果45を取得する。また、解析結果処理部54は、取得した解析結果45をまとめて変更後ソースコードの解析結果43を生成する。また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 実施の形態3のソースコード解析装置3は、実施の形態1のソースコード解析装置1の効果と同様の効果を有する。
 加えて、実施の形態3のソースコード解析装置3によれば、上位のモジュールに含まれる解析対象関数から下位のモジュールに含まれる解析対象関数に順に解析対象関数の解析が行われる。このため、上位のモジュールに含まれる解析対象関数から下位のモジュールに含まれる解析対象関数に与えられる入力が定まっていない段階で下位のモジュールに含まれる解析対象関数の解析が行われることを抑制することができ、当該入力が定まるまで下位のモジュールに含まれる解析対象関数の解析を待たなければならないこと、当該入力が定まった後に下位のモジュールに含まれる解析対象関数の解析を再度行わなければならなくなること等を抑制することができる。これにより、変更後ソースコード41の解析に要する時間を短くすることができる。
 4 実施の形態4
 以下では、実施の形態4のソースコード解析装置が実施の形態1のソースコード解析装置1と異なる点が説明される。説明されない点については、実施の形態1のソースコード解析装置1において採用される構成と同様の構成が実施の形態4のソースコード解析装置においても採用される。
 図1は、実施の形態4のソースコード解析装置のハードウェア構成を模式的に図示するブロック図でもある。
 図15は、実施の形態4のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図15に図示される実施の形態4のソースコード解析装置4は、入力値処理特定部59をさらに備える点で、図2に図示される実施の形態1のソースコード解析装置1と異なる。
 入力値処理特定部59は、関数に入力される入力値に対して当該関数において行われる処理を特定する。また、入力値処理特定部59は、特定した処理に基づいて、当該関数に入力される入力値の範囲を制限する。例えば、入力値処理特定部59は、特定した処理に基づいて、関数に入力される入力値の範囲の上限値を上げること、及び/又は関数に入力される入力値の範囲の下限値を下げることを行う。
 図16は、実施の形態4のソースコード解析装置に入力される変更後ソースコードの例を図示する図である。図17は、実施の形態4のソースコード解析装置に格納される値域情報の例を図示する図である。
 図17に図示される変更後ソースコード41においては、関数funcAが、引数arg1を有するfuncB()を呼び出し、funcB()が引数arg1を2乗して戻り値として返す。
 したがって、引数arg1が正の値である場合に関数funcBが返す戻り値は、引数arg1が当該正の値の絶対値と同じ絶対値を有する負の値である場合に関数funcBが返す戻り値と同じである。このため、このため、図17に図示されるように、関数funcBの解析の要否の判定においては、関数funcBに入力される引数arg1の範囲が-5以上5以下である場合であっても、引数arg1を2乗するという処理に応じて当該範囲を0以上5以下という範囲に制限することができる。
 図18及び図19は、実施の形態4のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 ソースコード解析装置4は、図18及び図19に図示されるステップS401からS414までを実行する。
 ステップS401においては、解析処理部52が、ソースコード解析装置1に入力された変更前ソースコードの解析結果42を取得する。
 続くステップS402においては、変更関数抽出処理部51が、ソースコード解析装置1に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。また、変更関数抽出処理部51は、変更後ソースコード41と変更前ソースコード44との差分を抽出する。また、変更関数抽出処理部51は、抽出した差分から変更関数を抽出する。また、変更関数抽出処理部51は、抽出した変更関数を解析対象リストに追加する。また、変更関数抽出処理部51は、取得した変更後ソースコード41を格納部55に格納する。
 続くステップS403からS413までの解析対象リストループにおいては、解析対象リストに含まれる全ての関数についてステップS404からS412までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS404においては、解析処理部52が、解析対象リストに含まれる関数を取り出す。
 続くステップS405においては、解析処理部52が、取り出した関数の解析を行う。
 続くステップS406においては、解析処理部52が、解析を行った関数が入力に影響を与える影響関数を変更後ソースコード41から抽出する。また、解析処理部52は、抽出した影響関数を判定対象リストに追加する。
 続くステップS407においては、入力値処理特定部59が、判定対象リストに追加した関数に入力される入力値に対して行われる処理に応じて当該関数に入力される入力値の範囲を制限する。
 続くステップS408からS412までの判定対象リストループにおいては、判定対象リストに含まれる全ての関数についてステップS409からS411までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS409においては、解析要否判定処理部53が、判定対象リストに含まれる関数を取り出す。
 ステップS410においては、解析要否判定処理部53が、格納部55に格納された解析結果45に含まれる値域情報71を取得する。また、解析要否判定処理部53は、変更後ソースコード41において取り出した関数に入力される入力値の範囲が、変更前ソースコード44において取り出した関数に入力される入力値の範囲より広いか否かを判定する。前者の入力値の範囲が後者の入力値の範囲より広いと判定された場合は、ステップS411が実行される。前者の入力値の範囲が後者の入力値の範囲より狭いと判定された場合は、ステップS412が実行される。
 ステップS411においては、解析要否判定処理部53が、取り出した関数を解析対象リストに追加する。これにより、解析対象リストに解析対象関数が追加される。
 ステップS414においては、解析結果処理部54が、解析結果45を取得する。また、解析結果処理部54は、取得した解析結果45をまとめて変更後ソースコードの解析結果43を生成する。また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 実施の形態4のソースコード解析装置4は、実施の形態1のソースコード解析装置1の効果と同様の効果を有する。
 加えて、実施の形態4のソースコード解析装置4によれば、関数に入力される入力値に対して行われる処理に応じて関数に入力される入力値の範囲が制限される。このため、変更後ソースコード41を解析するのに要する時間を短くすることができる。
 5 実施の形態5
 以下では、実施の形態5のソースコード解析装置が実施の形態1のソースコード解析装置1と異なる点が説明される。説明されない点については、実施の形態1のソースコード解析装置1において採用される構成と同様の構成が実施の形態5のソースコード解析装置においても採用される。
 図1は、実施の形態5のソースコード解析装置のハードウェア構成を模式的に図示するブロック図でもある。
 図20は、実施の形態5のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図20に図示される実施の形態5のソースコード解析装置5は、解析階層数48がさらに入力され、解析階層指定部60をさらに備える点で、図2に図示される実施の形態1のソースコード解析装置1と異なる。
 解析階層数48は、変更関数が属する階層と解析対象関数が属する階層との階層差の上限を示す。
 解析階層指定部60は、解析対象関数が属する階層を指定する。解析階層指定部60は、ソースコード解析装置5に入力された解析階層数48を取得し、取得した解析階層数48にしたがって解析対象関数が属する階層を指定する。
 解析処理部52は、指定された階層に属する解析対象関数の解析を行う。しかし、解析処理部52は、指定された階層以外の階層に属する関数の解析を行わない。
 これにより、変更関数から解析階層数48により指定された階層差の上限以下の階層差離れた関数のみが解析対象関数とされ、当該上限より大きい階層差離れた関数が解析対象関数とされず、変更関数が属する階層に近い階層に属する解析対象関数のみの解析を行うことができる。
 図21及び図22は、実施の形態5のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 実施の形態5のソースコード解析装置5は、図21及び図22に図示されるステップS501からS517までを実行する。
 ステップS501においては、解析階層指定部60が、ソースコード解析装置5に入力された解析階層数48を取得する。
 ステップS502においては、解析処理部52が、ソースコード解析装置5に入力された変更前ソースコードの解析結果42を取得する。
 続くステップS503においては、変更関数抽出処理部51が、ソースコード解析装置5に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。また、変更関数抽出処理部51は、変更後ソースコード41と変更前ソースコード44との差分を抽出する。また、変更関数抽出処理部51は、抽出した差分から変更関数を抽出する。また、変更関数抽出処理部51は、抽出した変更関数を解析対象リストに追加する。また、変更関数抽出処理部51は、取得した変更後ソースコード41を格納部55に格納する。
 続くステップS504においては、解析階層指定部60が、追加した変更関数に0という階層数を付与する。
 続くステップS505からS516までの解析対象リストループにおいては、解析対象リストに含まれる全ての関数についてステップS506からS515までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS506においては、解析処理部52が、解析対象リストに含まれる関数を取り出す。
 続くステップS507においては、解析処理部52が、取り出した関数の解析を行う。
 続くステップS508においては、解析処理部52が、解析を行った関数が入力に影響を与える影響関数を変更後ソースコード41から抽出する。また、解析処理部52は、抽出した影響関数を判定対象リストに追加する。
 続くステップS509においては、解析階層指定部60が、取り出した関数に付与されている階層数に1を加えた階層数を追加した関数に付与する。
 続くステップS510からS515までの判定対象リストループにおいては、判定対象リストに含まれる全ての関数についてステップS511からS514までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS511においては、解析要否判定処理部53が、判定対象リストに含まれる関数を取り出す。
 ステップS512においては、解析要否判定処理部53が、取り出した関数に付与されている階層数が、解析階層指定部60により指定された階層数の上限以下であるか否かを判定する。取り出した関数に付与されている階層数が、解析階層指定部60により指定された階層数の上限以下であると判定された場合は、ステップS513が実行される。取り出した関数に付与されている階層数が、解析階層指定部60により指定された階層数の上限より大きい場合は、ステップS515が実行される。
 ステップS513においては、解析要否判定処理部53が、格納部55に格納された解析結果45に含まれる値域情報71を取得する。また、解析要否判定処理部53は、変更後ソースコード41において取り出した関数に入力される入力値の範囲が、変更前ソースコード44において取り出した関数に入力される入力値の範囲より広いか否かを判定する。前者の入力値の範囲が後者の入力値の範囲より広いと判定された場合は、ステップS514が実行される。前者の入力値の範囲が後者の入力値の範囲より狭いと判定された場合は、ステップS515が実行される。
 ステップS514においては、解析要否判定処理部53が、取り出した関数を解析対象リストに追加する。これにより、解析対象リストに解析対象関数が追加される。
 ステップS517においては、解析結果処理部54が、解析結果45を取得する。また、解析結果処理部54は、取得した解析結果45をまとめて変更後ソースコードの解析結果43を生成する。また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 実施の形態5のソースコード解析装置5は、実施の形態1のソースコード解析装置1の効果と同様の効果を有する。
 加えて、実施の形態5のソースコード解析装置5によれば、変更関数から解析階層数48により指定された階層差の上限以下の階層差離れた関数のみが解析対象関数とされ、当該上限より大きい階層差離れた関数が解析対象関数とされず、変更関数が属する階層に近い階層に属する解析対象関数のみの解析を行うことができる。これにより、変更後ソースコード41の解析に要する時間を短くすることができる。
 6 実施の形態6
 以下では、実施の形態6のソースコード解析装置が実施の形態1のソースコード解析装置1と異なる点が説明される。説明されない点については、実施の形態1のソースコード解析装置1において採用される構成と同様の構成が実施の形態6のソースコード解析装置においても採用される。
 図1は、実施の形態6のソースコード解析装置のハードウェア構成を模式的に図示するブロック図でもある。
 図23は、実施の形態6のソースコード解析装置の機能構成を模式的に図示するブロック図である。
 図23に図示される実施の形態6のソースコード解析装置6は、許容値域49がさらに入力され、許容値域指定部61をさらに備える点で、図2に図示される実施の形態1のソースコード解析装置1と異なる。
 入力される許容値域49は、変更関数及び影響関数に含まれる関数に入力される入力値の許容される範囲を示す。
 許容値域指定部61は、変更関数及び影響関数に含まれる関数に入力される入力値の許容される範囲を示す許容値域を指定する。許容値域指定部61は、ソースコード解析装置6に入力された許容値域49を取得し、取得した許容値域49にしたがって許容値域を指定する。
 解析要否判定処理部53は、変更関数及び影響関数に含まれる関数に入力される入力値の範囲が、指定された許容値域により示される、当該関数に入力される入力値の許容される範囲より狭い場合は、当該関数が解析対象関数でないと判定し、当該関数に入力される入力値の範囲が、指定された許容値域により示される、当該関数に入力される入力値の許容される範囲より広い場合は、当該関数が解析対象関数であると判定する。
 これにより、変更関数及び影響関数に含まれる関数に入力される入力値の取りうる値の範囲が変更後ソースコード41を設定する時点であらかじめ判明している場合に、当該範囲を示す許容値域49をソースコード解析装置6に入力することにより、解析が行われる解析対象関数を減らすことができる。
 図24及び図25は、実施の形態6のソースコード解析装置が行う処理の流れを図示するフローチャートである。
 ソースコード解析装置6は、図24及び図25に図示されるステップS601からS616までを実行する。
 ステップS601においては、許容値域指定部61が、ソースコード解析装置6に入力された許容値域49を取得する。
 続くステップS602においては、解析処理部52が、ソースコード解析装置1に入力された変更前ソースコードの解析結果42を取得する。
 続くステップS603においては、変更関数抽出処理部51が、ソースコード解析装置1に入力された変更後ソースコード41、及び格納部55に格納されている変更前ソースコード44を取得する。また、変更関数抽出処理部51は、変更後ソースコード41と変更前ソースコード44との差分を抽出する。また、変更関数抽出処理部51は、抽出した差分から変更関数を抽出する。また、変更関数抽出処理部51は、抽出した変更関数を解析対象リストに追加する。また、変更関数抽出処理部51は、取得した変更後ソースコード41を格納部55に格納する。
 続くステップS604においては、許容値域指定部61が、取得した許容値域49にしたがって、追加した関数に許容値域を付与する。
 続くステップS605からS615までの解析対象リストループにおいては、解析対象リストに含まれる全ての関数についてステップS606からS614までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS606においては、解析処理部52が、解析対象リストに含まれる関数を取り出す。
 続くステップS607においては、解析処理部52が、取り出した関数の解析を行う。
 続くステップS608においては、解析処理部52が、解析を行った関数が入力に影響を与える影響関数を変更後ソースコード41から抽出する。また、解析処理部52は、抽出した影響関数を判定対象リストに追加する。
 続くステップS609においては、許容値域指定部61が、取得した許容値域49にしたがって、追加した関数に許容値域を付与する。
 続くステップS610からS615までの判定対象リストループにおいては、判定対象リストに含まれる全ての関数についてステップS611からS614までの処理が実行されるまで、当該処理が繰り返し実行される。
 ステップS611においては、解析要否判定処理部53が、判定対象リストに含まれる関数を取り出す。
 ステップS612においては、解析要否判定処理部53が、格納部55に格納された解析結果45に含まれる値域情報71を取得する。また、解析要否判定処理部53は、変更後ソースコード41において取り出した関数に入力される入力値の範囲が、変更前ソースコード44において取り出した関数に入力される入力値の範囲より広いか否かを判定する。前者の入力値の範囲が後者の入力値の範囲より広いと判定された場合は、ステップS613が実行される。前者の入力値の範囲が後者の入力値の範囲より狭いと判定された場合は、ステップS615が実行される。
 ステップS613においては、解析要否判定処理部53が、取り出した関数に入力される入力値の範囲が当該関数に入力される入力値の許容される範囲に収まっていないか否かが判定される。前者の入力値の範囲が後者の入力値の範囲に収まっていないと判定された場合は、ステップS614が実行される。前者の入力値の範囲が後者の入力値の範囲に収まっていると判定された場合は、ステップS615が実行される。
 ステップS614においては、解析要否判定処理部53が、取り出した関数を解析対象リストに追加する。これにより、解析対象リストに解析対象関数が追加される。
 ステップS616においては、解析結果処理部54が、解析結果45を取得する。また、解析結果処理部54は、取得した解析結果45をまとめて変更後ソースコードの解析結果43を生成する。また、解析結果処理部54は、生成した変更後ソースコードの解析結果43を出力する。
 実施の形態6のソースコード解析装置6は、実施の形態1のソースコード解析装置1の効果と同様の効果を有する。
 加えて、実施の形態6のソースコード解析装置6によれば、変更関数及び影響関数に含まれる関数に入力される入力値の取りうる値の範囲が変更後ソースコード41を設定する時点であらかじめ判明している場合に、当該範囲を示す許容値域49をソースコード解析装置6に入力することにより、解析が行われる解析対象関数を減らすことができる。これにより、変更後ソースコード41を解析するのに要する時間を短くすることができる。
 なお、本発明は、その発明の範囲内において、各実施の形態を自由に組み合わせたり、各実施の形態を適宜、変形、省略することが可能である。
 この発明は詳細に説明されたが、上記した説明は、すべての局面において、例示であって、この発明がそれに限定されるものではない。例示されていない無数の変形例が、この発明の範囲から外れることなく想定され得るものと解される。
 1,2,3,4,5,6 ソースコード解析装置、51 変更関数抽出処理部、52 解析処理部、53 解析要否判定処理部、54 解析結果処理部、56 検証済情報格納処理部、57 階層特定処理部、58 解析順序指定部、59 入力値処理特定部、60 解析階層指定部、61 許容値域指定部。

Claims (10)

  1.  変更後ソースコードに含まれる、変更前ソースコードからの変更箇所に含まれる変更関数を抽出する変更関数抽出処理部と、
     前記変更関数により入力を与えられる影響関数を前記変更後ソースコードから抽出する解析処理部と、
     前記変更関数及び前記影響関数に含まれる関数に入力される入力値の範囲に基づいて前記関数が前記解析対象関数であるか否か判定する解析要否判定処理部と、
    を備え、
     前記解析処理部は、前記解析要否判定処理部により解析を要すると判定された解析対象関数の解析を行い、
     前記解析対象関数の解析結果を含む、前記変更後ソースコードの解析結果を出力する解析結果処理部をさらに備える
    ソースコード解析装置。
  2.  前記解析要否判定処理部は、前記関数が前記解析対象関数であるか否か判定する際に、前記変更後ソースコードにおいて前記関数に入力される入力値の範囲が、前記変更前ソースコードにおいて前記関数に入力される入力値の範囲より狭い場合は、前記関数が前記解析対象関数でないと判定する
    請求項1のソースコード解析装置。
  3.  前記関数に入力される入力値は、前記関数の引数、前記関数により呼び出される他の関数が返す戻り値、及び前記関数により読み出されるグローバル変数からなる群より選択される少なくともひとつを含む
    請求項1又は2のソースコード解析装置。
  4.  前記解析処理部は、前記解析対象関数の解析において、前記解析対象関数に入力される入力値を振って検証を行い、前記検証が既に行われている場合は、前記検証が行われた値以外について前記解析対象関数に入力される入力値を振って検証を行い、
     前記検証が行われた値を示す検証済情報を格納部に格納する検証済情報格納処理部をさらに備える
    請求項1から3までのいずれかのソースコード解析装置。
  5.  前記解析対象関数の解析順序を指定する解析順序指定部をさらに備え、
     前記解析処理部は、前記解析対象関数の解析順序順に前記解析対象関数の解析を行う
    請求項1から4までのいずれかのソースコード解析装置。
  6.  前記解析対象関数の解析順序は、前記変更後ソースコードに含まれる関数の階層構造において前記解析対象関数が属する階層が高くなるほど先になる
    請求項5のソースコード解析装置。
  7.  前記階層を特定する階層特定処理部をさらに備える
    請求項6のソースコード解析装置。
  8.  前記関数に入力される入力値に対して前記関数において行われる処理を特定し、前記処理に応じて前記変更後ソースコードにおいて前記関数に入力される入力値の範囲を制限する入力値処理特定部をさらに備える
    請求項1から7までのいずれかのソースコード解析装置。
  9.  前記解析対象関数が属する階層を指定する解析階層指定部をさらに備え、
     前記解析処理部は、指定された階層に属する解析対象関数の解析を行う
    請求項1から8までのいずれかのソースコード解析装置。
  10.  前記関数に入力される入力値の許容される範囲を示す許容値域を指定する許容値域指定部をさらに備え、
     前記解析要否判定処理部は、前記関数に入力される入力値の範囲が前記関数に入力される入力値の許容される範囲より狭い場合は、前記関数が前記解析対象関数でないと判定する
    請求項1から9までのいずれかのソースコード解析装置。
PCT/JP2019/043034 2019-11-01 2019-11-01 ソースコード解析装置 WO2021084735A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/JP2019/043034 WO2021084735A1 (ja) 2019-11-01 2019-11-01 ソースコード解析装置
JP2021554024A JP7237186B2 (ja) 2019-11-01 2019-11-01 ソースコード解析装置
US17/761,327 US11907710B2 (en) 2019-11-01 2019-11-01 Source code analysis apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2019/043034 WO2021084735A1 (ja) 2019-11-01 2019-11-01 ソースコード解析装置

Publications (1)

Publication Number Publication Date
WO2021084735A1 true WO2021084735A1 (ja) 2021-05-06

Family

ID=75714986

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/043034 WO2021084735A1 (ja) 2019-11-01 2019-11-01 ソースコード解析装置

Country Status (3)

Country Link
US (1) US11907710B2 (ja)
JP (1) JP7237186B2 (ja)
WO (1) WO2021084735A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008191963A (ja) * 2007-02-06 2008-08-21 Nec Corp ソースコード検証システム、ソースコード検証方法、およびソースコード検証用プログラム
JP2009104252A (ja) * 2007-10-19 2009-05-14 Toshiba Corp デバッグ支援装置およびデバッグ支援方法
WO2019102786A1 (ja) * 2017-11-21 2019-05-31 三菱電機株式会社 ソースコード分割装置、ソースコード解析装置、ソースコード分割方法及びソースコード分割プログラム

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2009011057A1 (ja) 2007-07-19 2010-09-09 富士通株式会社 アプリケーション解析プログラム、アプリケーション解析方法およびアプリケーション解析装置
US10372584B2 (en) 2015-01-30 2019-08-06 Hitachi, Ltd. Software inspection apparatus
US10180836B1 (en) * 2015-08-24 2019-01-15 Amazon Technologies, Inc. Generating source code review comments using code analysis tools

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008191963A (ja) * 2007-02-06 2008-08-21 Nec Corp ソースコード検証システム、ソースコード検証方法、およびソースコード検証用プログラム
JP2009104252A (ja) * 2007-10-19 2009-05-14 Toshiba Corp デバッグ支援装置およびデバッグ支援方法
WO2019102786A1 (ja) * 2017-11-21 2019-05-31 三菱電機株式会社 ソースコード分割装置、ソースコード解析装置、ソースコード分割方法及びソースコード分割プログラム

Also Published As

Publication number Publication date
US20220342664A1 (en) 2022-10-27
JP7237186B2 (ja) 2023-03-10
US11907710B2 (en) 2024-02-20
JPWO2021084735A1 (ja) 2021-05-06

Similar Documents

Publication Publication Date Title
US9621571B2 (en) Apparatus and method for searching for similar malicious code based on malicious code feature information
Han et al. Malware analysis using visualized image matrices
TWI611349B (zh) 檢測系統及其方法
WO2019148816A1 (en) Method and apparatus for data compilation, electronic device and computer readable storage medium
JP2017004123A (ja) 判定装置、判定方法および判定プログラム
WO2018070404A1 (ja) マルウェア解析装置、マルウェア解析方法、及び、マルウェア解析プログラムが格納された記録媒体
JP2016099857A (ja) 不正プログラム対策システムおよび不正プログラム対策方法
KR20200073822A (ko) 악성코드 분류 방법 및 그 장치
WO2021084735A1 (ja) ソースコード解析装置
JP7427896B2 (ja) データベースの分割システム、データベースの分割方法、及びデータベースの分割プログラム
JP6945768B2 (ja) 検知装置、検知方法、及び、検知プログラム
JP5766650B2 (ja) 情報処理装置、監視方法および監視プログラム
JP6274090B2 (ja) 脅威分析装置、及び脅威分析方法
JP7326803B2 (ja) 文書管理装置、文書管理方法、及び、プログラム
JP5595304B2 (ja) プログラム試験装置、プログラム試験装置のプログラム試験方法およびプログラム試験プログラム
CN105279434A (zh) 恶意程序样本家族命名方法及装置
WO2020115853A1 (ja) 情報処理装置、情報処理方法及び情報処理プログラム
KR101829426B1 (ko) 문자열 점수 기반 소프트웨어 저장 장치와 분류 장치 및 그 방법
KR101480244B1 (ko) 클래스 단위의 시그니처를 이용한 악성 어플리케이션 탐지 방법 및 장치
JP2007133632A (ja) セキュリティポリシー設定方法及びプログラム
JP7501782B2 (ja) 活動痕跡抽出装置、活動痕跡抽出方法および活動痕跡抽出プログラム
JP6390217B2 (ja) ソフトウェア変更プログラム、ソフトウェア変更装置、及びソフトウェア変更方法
JP2008262473A (ja) 設備保全管理システム
US20240184887A1 (en) Activity trace extraction device, activity trace extraction method, and activity trace extraction program
JP7287478B2 (ja) 学習装置、判別システム、学習方法及び学習プログラム

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: 19951033

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2021554024

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19951033

Country of ref document: EP

Kind code of ref document: A1