Abnormal code positioning method and device, computer equipment, readable storage medium and program product

By acquiring the graph representation vector and code text representation vector of the source code to be detected, and combining them with a self-attention mechanism, the abnormal code region is accurately located, which solves the problem of inaccurate abnormal code region location in existing technologies and improves the efficiency and accuracy of vulnerability detection.

CN121278735APending Publication Date: 2026-01-06CHINA ELECTRONICS RELIABILITY AND ENVIRONMENTAL TESTING INSTITUTE ((THE FIFTH INSTITUTE OF ELECTRONICS MINISTRY OF INDUSTRY AND INFORMATION TECHNOLOGY) (CHINA SAIBAO LABORATORY)

Patent Information

Application Number
CN202511842244.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

Existing technologies are not accurate enough in locating abnormal code regions, causing code reviewers to spend a lot of time reviewing non-high-risk code segments.

Method used

By obtaining the graph representation vector and code text representation vector of the source code to be detected, and combining them with a self-attention mechanism, the self-attention score of each code statement in the abnormal code block is determined, thereby accurately locating the abnormal code region.

Benefits of technology

It improves the accuracy and efficiency of locating abnormal code regions, reduces the review time for non-high-risk code segments, and improves the efficiency and accuracy of vulnerability detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121278735A_ABST
    Figure CN121278735A_ABST
Patent Text Reader

Abstract

The invention relates to an abnormal code positioning method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring a graph representation vector and a code text representation vector corresponding to a to-be-detected source code; the graph representation vector is used for representing a code structure corresponding to the source code to be detected; the code text representation vector is used for representing code semantics corresponding to the source code to be detected; according to the graph representation vector and the code text representation vector, positioning an abnormal code block from the source code to be detected; determining a self-attention score corresponding to each code statement in the abnormal code block through a self-attention mechanism; the self-attention score is used for representing the influence degree of the corresponding code statement on the condition that the abnormal code block is predicted to be abnormal; and determining an abnormal code area of the abnormal code block according to the self-attention score corresponding to each code statement in the abnormal code block. By adopting the method, the abnormal code area positioning accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to an anomaly code location method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Technology

[0002] With the increasing complexity of the network environment and the rapid evolution of attack methods, various threats to software systems have long plagued software development organizations. Among these, software vulnerabilities, as a critical source of risk, can lead to problems such as information leakage, data tampering, and system crashes, seriously threatening system security and personal privacy. Therefore, vulnerability detection has become the cornerstone of protecting system security. It aims to discover and mitigate the impact of vulnerabilities, prevent malicious attacks, and improve the overall quality, usability, and trustworthiness of software. Today, vulnerability detection has become an indispensable part of modern software development.

[0003] In related technologies, deep learning-based software vulnerability risk module prediction techniques can identify software code modules predicted to have a high risk of vulnerability. However, not all code segments in a potentially vulnerable file are actually vulnerable. This means that even after defect prediction, if most code segments in the predicted vulnerable module are not high-risk, code reviewers still need to expend considerable effort to review the entire suspected file.

[0004] Therefore, there is a problem with the inaccurate location of abnormal code regions in related technologies. Summary of the Invention

[0005] Therefore, it is necessary to provide an exception code location method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of exception code region location in response to the above-mentioned technical problems.

[0006] Firstly, this application provides a method for locating abnormal codes, including:

[0007] Obtain the graph representation vector and code text representation vector corresponding to the source code to be detected; the graph representation vector is used to represent the code structure corresponding to the source code to be detected; the code text representation vector is used to represent the code semantics corresponding to the source code to be detected; the source code to be detected includes at least one code block; each code block includes at least one code statement;

[0008] Based on the graph representation vector and the code text representation vector, the abnormal code block is located from the source code to be detected;

[0009] A self-attention score is determined for each code statement in the abnormal code block using a self-attention mechanism; the self-attention score is used to characterize the degree of influence of the corresponding code statement on the prediction that the abnormal code block is abnormal.

[0010] The abnormal code region of the abnormal code block is determined based on the self-attention score corresponding to each code statement in the abnormal code block.

[0011] In one embodiment, each code statement includes at least one code lexical; determining the self-attention score corresponding to each code statement in the abnormal code block using a self-attention mechanism includes:

[0012] For any given code statement, obtain the self-attention score corresponding to each code term in the given code statement;

[0013] The self-attention score corresponding to any given code statement is determined based on the self-attention score corresponding to each code term in the given code statement.

[0014] In one embodiment, obtaining the self-attention score corresponding to each code lexical in any given code statement includes:

[0015] Obtain the attention weight information of each code word in each self-attention layer in any code statement; the attention weight information of any code word includes the attention weight assigned to each code word in any code statement.

[0016] The attention weights assigned to each code word in each self-attention layer are summed to determine the self-attention score corresponding to each code word in any given code statement.

[0017] In one embodiment, obtaining the graph representation vector and code text representation vector corresponding to the source code to be detected includes:

[0018] The source code to be detected is split into a sequence of code words, and a corresponding numerical identifier is assigned to each code word in the sequence of code words according to the pre-constructed word list mapping relationship, so as to obtain a sequence of numerical identifiers;

[0019] Obtain the adjacency matrix corresponding to the code lexical sequence, optimize the numerical identifier sequence and the adjacency matrix to obtain the optimized numerical identifier sequence and the optimized adjacency matrix; the lengths of the optimized numerical identifier sequence and the optimized adjacency matrix meet a preset condition;

[0020] Based on the optimized numerical identifier sequence and the optimized adjacency matrix, the graph representation vector and code text representation vector corresponding to the source code to be detected are determined.

[0021] In one embodiment, determining the graph representation vector and code text representation vector corresponding to the source code to be detected based on the optimized numerical identifier sequence and the optimized adjacency matrix includes:

[0022] The optimized numerical identifier sequence and the optimized adjacency matrix are input into a pre-trained graph attention-guided code encoder, which outputs the code text representation vector and the graph representation vector.

[0023] The pre-trained graph attention-guided code encoder includes an embedding layer and a graph structure encoder. The embedding layer maps the optimized numerical identifier sequence to a high-dimensional space and outputs the code text representation vector. The graph structure encoder aggregates the structural dependencies between code terms in the code term sequence based on the optimized adjacency matrix and outputs the graph representation vector.

[0024] In one embodiment, locating the abnormal code block from the source code to be detected based on the graph representation vector and the code text representation vector includes:

[0025] The graph representation vector and the code text representation vector are input into a pre-trained abnormal code detection model, and the classification result corresponding to each code block in the source code to be detected is output.

[0026] Based on the classification results corresponding to each code block in the source code to be detected, the abnormal code blocks in the source code to be detected are determined.

[0027] Secondly, this application also provides an anomaly code location device, comprising:

[0028] The vector acquisition module is used to acquire the graph representation vector and code text representation vector corresponding to the source code to be detected; the graph representation vector is used to represent the code structure corresponding to the source code to be detected; the code text representation vector is used to represent the code semantics corresponding to the source code to be detected; the source code to be detected includes at least one code block; each code block includes at least one code statement;

[0029] The localization module is used to locate the abnormal code block from the source code to be detected based on the graph representation vector and the code text representation vector.

[0030] The score determination module is used to determine the self-attention score corresponding to each code statement in the abnormal code block through a self-attention mechanism; the self-attention score is used to characterize the degree of influence of the corresponding code statement on the prediction that the abnormal code block is abnormal.

[0031] The exception determination module is used to determine the abnormal code region of the abnormal code block based on the self-attention score corresponding to each code statement in the abnormal code block.

[0032] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, implements the steps of the method described above.

[0033] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0034] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described method.

[0035] The aforementioned abnormal code localization method, apparatus, computer device, computer-readable storage medium, and computer program product acquire graph representation vectors and code text representation vectors corresponding to the source code to be detected. The graph representation vectors represent the code structure of the source code to be detected, and the code text representation vectors represent the code semantics of the source code to be detected. The source code to be detected includes at least one code block; each code block includes at least one code statement. Abnormal code blocks are located from the source code to be detected based on the graph representation vectors and code text representation vectors. A self-attention score is determined for each code statement in the abnormal code block using a self-attention mechanism. The self-attention score represents the degree of influence of the corresponding code statement on the prediction that the abnormal code block is abnormal. The abnormal code region of the abnormal code block is determined based on the self-attention score for each code statement in the abnormal code block.

[0036] Thus, by using the graph representation vector and code text representation vector corresponding to the source code to be detected, abnormal code blocks with potential anomalies can be more accurately identified from both the code structure and semantic dimensions of the source code. Furthermore, a self-attention mechanism is used to determine the self-attention score for each code statement within the abnormal code block, thereby assessing the degree of influence of the code statement on the prediction of the abnormal code block as an anomaly. This allows for more efficient and accurate identification of anomalous code regions within the abnormal code block. This application not only identifies abnormal code blocks in the source code to be detected but also efficiently and accurately locates anomalous code regions within them, effectively improving the efficiency and accuracy of anomaly detection in target source code. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a flowchart illustrating an exception code location method in one embodiment;

[0039] Figure 2 This is an architecture diagram of an implementation of an exception code location method in one embodiment;

[0040] Figure 3 This is a flowchart illustrating an exception code location method in another embodiment;

[0041] Figure 4 This is a structural block diagram of an exception code locator in one embodiment;

[0042] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0044] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0045] In one embodiment, such as Figure 1 As shown, an exception code localization method is provided. This embodiment illustrates the method by applying it to a computer device. It is understood that the computer device may be a terminal, a server, or a system including both a terminal and a server. In this embodiment, the method includes the following steps:

[0046] Step S110: Obtain the graph representation vector and code text representation vector corresponding to the source code to be detected.

[0047] The source code to be tested can refer to the source code that needs to be subjected to anomaly detection (vulnerability detection).

[0048] Among them, the graph representation vector is used to represent the code structure corresponding to the source code to be detected.

[0049] Among them, the code text representation vector is used to represent the code semantics corresponding to the source code to be detected.

[0050] The source code to be tested includes at least one code block.

[0051] The source code to be detected can be extracted and broken down into multiple code blocks. The purpose of this step is to decompose a large codebase into smaller units, making vulnerability detection more granular and effective. Each code block may correspond to a different function or module of the application.

[0052] In this context, a code block is a functional unit composed of code, and a code block can run independently. For example, a function, a class definition, or a module are all code blocks. Dependencies exist between different code blocks.

[0053] Each code block includes at least one code statement; for example, a code block may include one or more lines of complete code.

[0054] In a specific implementation, the computer device can obtain the graph representation vector and code text representation vector corresponding to the source code to be detected. In some embodiments, the source code to be detected can be split into a sequence of code tokens, and the sequence of code tokens can be encoded by a graph-guided attention transformer encoder (GATE) to output graph representation vectors and code text representation vectors, thereby combining graph attention and text learning to more fully represent code information.

[0055] Step S120: Locate the abnormal code block from the source code to be detected based on the graph representation vector and the code text representation vector.

[0056] In practice, computer devices can locate code blocks with potential abnormal risks from the code blocks of the source code to be detected based on graph representation vectors and code text representation vectors, and identify them as abnormal code blocks.

[0057] Specifically, anomaly evaluation can be performed on each code block based on graph representation vectors and code text representation vectors, yielding anomaly evaluation results for each code block. These results characterize the probability of anomalies occurring within the code block and may include anomaly evaluation parameters such as probability parameters and scoring parameters. The specific format of these anomaly evaluation parameters is not limited here.

[0058] In some embodiments, taking the anomaly evaluation parameters including probability parameters as an example, the probability parameters characterize the probability of an anomaly risk occurring in a code block, and at least one code block ranked first by the probability parameters is selected as the anomaly code block.

[0059] Step S130: Determine the self-attention score for each code statement in the abnormal code block using a self-attention mechanism.

[0060] The self-attention score is used to characterize the degree to which the corresponding code statement influences the prediction that the abnormal code block is abnormal.

[0061] In practice, a self-attention mechanism can be used to score the degree of influence (importance) of each code statement in the abnormal code block that causes the source code to be detected to become abnormal, and to determine the self-attention score corresponding to each code statement in the abnormal code block.

[0062] Step S140: Determine the abnormal code region of the abnormal code block based on the self-attention score corresponding to each code statement in the abnormal code block.

[0063] In practice, the abnormal code region of the abnormal code block can be determined based on the self-attention score corresponding to each code statement in the abnormal code block.

[0064] In practical applications, the code region containing at least one code statement with the highest self-attention score in the abnormal code block can be considered an abnormal code region and thus a high-risk area for vulnerabilities.

[0065] In the above-described abnormal code localization method, the graph representation vector and code text representation vector corresponding to the source code to be detected are obtained. The graph representation vector is used to represent the code structure corresponding to the source code to be detected. The code text representation vector is used to represent the code semantics corresponding to the source code to be detected. The source code to be detected includes at least one code block. Each code block includes at least one code statement. The abnormal code block is located from the source code to be detected based on the graph representation vector and the code text representation vector. The self-attention score corresponding to each code statement in the abnormal code block is determined through a self-attention mechanism. The self-attention score is used to represent the degree of influence of the corresponding code statement on the abnormal code block being predicted to be abnormal. The abnormal code region of the abnormal code block is determined based on the self-attention score corresponding to each code statement in the abnormal code block.

[0066] Thus, by using the graph representation vector and code text representation vector corresponding to the source code to be detected, abnormal code blocks with potential anomalies can be more accurately identified from both the code structure and semantic dimensions of the source code. Furthermore, a self-attention mechanism is used to determine the self-attention score for each code statement within the abnormal code block, thereby assessing the degree of influence of the code statement on the prediction of the abnormal code block as an anomaly. This allows for more efficient and accurate identification of anomalous code regions within the abnormal code block. This application not only identifies abnormal code blocks in the source code to be detected but also efficiently and accurately locates anomalous code regions within them, effectively improving the efficiency and accuracy of anomaly detection in target source code.

[0067] In some embodiments, each code statement includes at least one code term; determining the self-attention score corresponding to each code statement in the abnormal code block through a self-attention mechanism includes: for any code statement, obtaining the self-attention score corresponding to each code term in any code statement; and determining the self-attention score corresponding to any code statement based on the self-attention score corresponding to each code term in any code statement.

[0068] In specific implementation, each code statement includes at least one code term. When determining the self-attention score for each code statement within an abnormal code block using a self-attention mechanism, the computer device can, for any given code statement, obtain the self-attention score corresponding to each code term in that code statement. Therefore, based on the self-attention scores corresponding to each code term in that code statement, the self-attention score for that given code statement is determined. Specifically, the self-attention scores corresponding to each code term in that given code statement are summed to obtain the self-attention score for that given code statement.

[0069] By applying the same processing to each code statement in the exception block, we can obtain the self-attention score for each code statement in the exception block.

[0070] In this embodiment, each code statement includes at least one code term. For any given code statement, the self-attention score corresponding to each code term is obtained. Based on the self-attention score corresponding to each code term in the given code statement, the self-attention score corresponding to the given code statement is determined. Thus, based on the self-attention score corresponding to each code term in the given code statement, the self-attention score corresponding to the given code statement can be accurately determined.

[0071] In some embodiments, for software source code vulnerability prediction models (abnormal code detection models) based on self-attention mechanisms, such as Transformer, the self-attention mechanism itself can be used to locate high-risk code vulnerabilities. In an abnormal code detection model based on self-attention mechanisms, the self-attention layer is used to calculate the attention weight of each code token (code lexicon), thereby generating an attention vector.

[0072] The generated attention weights are used to indicate which code statements the model should focus on. Typically, self-attention mechanisms are used to capture global dependencies, where attention weights represent how each code term in the input code term sequence is influenced by all other code terms in the sequence, thereby capturing the dependencies between code terms and generating more meaningful code representations.

[0073] In some embodiments, for any code statement, obtaining the self-attention score corresponding to each code term in any code statement includes: obtaining the attention weight information corresponding to each code term in any code statement at each self-attention layer; the attention weight information corresponding to any code term includes the attention weight assigned to each code term in any code statement; summing the attention weights assigned to each code term in each self-attention layer to determine the self-attention score corresponding to each code term in the any code statement.

[0074] In a specific implementation, during the process of obtaining the self-attention score corresponding to each code word in any code statement, the computer device can obtain the attention weight information corresponding to each code word in each self-attention layer for any code statement; wherein, the attention weight information corresponding to any code word includes the attention weight assigned to each code word in any code statement.

[0075] Specifically, the self-attention mechanism processes each input code term through three different linear layers, generating a query vector (Q), a key vector (K), and a value vector (V). The Q vector of each code term is then multiplied by the K vectors of all other code terms (including itself) to obtain the attention score of that code term on all other code terms. A higher score indicates a stronger association between the two terms. The obtained attention scores are then processed using Softmax to convert them into self-attention weights.

[0076] The self-attention score for each code word in any given code statement is determined by summing the attention weights assigned to each code word in each self-attention layer.

[0077] The technical solution of this embodiment obtains the self-attention weight information corresponding to each code word in each self-attention layer of any code statement. The attention weight information corresponding to any code word includes the attention weight assigned to each code word in any code statement. The attention weights assigned to each code word in each self-attention layer are summed to determine the self-attention score corresponding to each code word in any code statement. In this way, by aggregating the attention assigned to code words in all self-attention layers, the key semantic units on which the model judges that the code has vulnerabilities can be accurately identified, thereby providing developers with interpretable and localizable defect root cause analysis, significantly improving the efficiency of vulnerability investigation and repair.

[0078] In some embodiments, obtaining the graph representation vector and code text representation vector corresponding to the source code to be detected includes: splitting the source code to be detected into a sequence of code tokens, assigning a corresponding numerical identifier to each code token in the sequence of code tokens according to a pre-constructed vocabulary mapping relationship, and obtaining a numerical identifier sequence; obtaining the adjacency matrix corresponding to the code token sequence, optimizing the numerical identifier sequence and the adjacency matrix to obtain an optimized numerical identifier sequence and an optimized adjacency matrix; the lengths of the optimized numerical identifier sequence and the optimized adjacency matrix satisfy a preset condition; and determining the graph representation vector and code text representation vector corresponding to the source code to be detected based on the optimized numerical identifier sequence and the optimized adjacency matrix.

[0079] In the specific implementation, during the process of obtaining the graph representation vector and code text representation vector corresponding to the source code to be detected, the source code to be detected is split into a sequence of code tokens, and then each code token in the sequence is assigned a corresponding numerical identifier (numerical ID) through a pre-constructed vocabulary mapping relationship, resulting in a numerical identifier sequence. The adjacency matrix corresponding to the code token sequence is obtained, and the numerical identifier sequence and adjacency matrix are optimized to obtain an optimized numerical identifier sequence and an optimized adjacency matrix. The lengths of the optimized numerical identifier sequence and the optimized adjacency matrix meet a preset condition. Thus, based on the optimized numerical identifier sequence and the optimized adjacency matrix, the graph representation vector and code text representation vector corresponding to the source code to be detected are determined.

[0080] The technical solution of this embodiment involves splitting the source code to be detected into a sequence of code tokens, assigning a corresponding numerical identifier to each code token in the sequence according to a pre-constructed vocabulary mapping relationship, and obtaining a numerical identifier sequence. The adjacency matrix corresponding to the code token sequence is then obtained, and the numerical identifier sequence and adjacency matrix are optimized to obtain an optimized numerical identifier sequence and an optimized adjacency matrix. The lengths of the optimized numerical identifier sequence and the optimized adjacency matrix meet preset conditions. Based on the optimized numerical identifier sequence and the optimized adjacency matrix, the graph representation vector and code text representation vector corresponding to the source code to be detected are determined.

[0081] In this way, by splitting the source code into tokens and mapping them to numerical identifier sequences, the code text is transformed into a form that the model can process, laying the foundation for capturing code semantics. At the same time, the adjacency matrix is ​​obtained and optimized simultaneously, which not only preserves the structural relationships of the code (such as syntax hierarchy and data / control flow dependencies), but also enhances the model's adaptability and processing stability to source code of different lengths by meeting preset conditions through uniform length. The resulting graph representation vector and code text representation vector can work together to carry the semantic information and structural features of the code, providing more comprehensive and accurate input for subsequent tasks such as vulnerability prediction, and effectively improving the model's ability to understand the deep logic and potential risks of the source code.

[0082] In some embodiments, determining the graph representation vector and code text representation vector corresponding to the source code to be detected based on the optimized numerical identifier sequence and the optimized adjacency matrix includes: inputting the optimized numerical identifier sequence and the optimized adjacency matrix into a pre-trained code encoder based on graph attention guidance, and outputting the code text representation vector and the graph representation vector.

[0083] The pre-trained graph attention-guided code encoder includes an embedding layer and a graph structure encoder. The embedding layer maps the optimized numerical identifier sequence to a high-dimensional space and outputs a code text representation vector. The graph structure encoder aggregates the structural dependencies between code terms in the code term sequence based on the optimized adjacency matrix and outputs a graph representation vector.

[0084] In practice, when the computer device determines the graph representation vector and code text representation vector corresponding to the source code to be detected based on the optimized numerical identifier sequence and the optimized adjacency matrix, it can input the optimized numerical identifier sequence and the optimized adjacency matrix into a pre-trained code encoder based on graph attention guidance, and output the code text representation vector and the graph representation vector.

[0085] The pre-trained graph attention-guided code encoder includes an embedding layer and a graph structure encoder. The optimized numerical label sequence is input into the embedding layer, which maps the optimized numerical label sequence to a high-dimensional space. ( The code text representation vector is output from the embedding dimension. Furthermore, positional information (such as the token's index in the sequence) can be added to obtain the code text representation vector, thus distinguishing the semantic differences of the same token at different positions. Additionally, the optimized adjacency matrix can be input into a graph structure encoder, which aggregates the structural dependencies between code tokens in the code token sequence based on the optimized adjacency matrix, outputting a graph representation vector.

[0086] The technical solution of this embodiment inputs the optimized numerical identifier sequence and the optimized adjacency matrix into a pre-trained graph attention-guided code encoder, and outputs a code text representation vector and a graph representation vector. The pre-trained graph attention-guided code encoder includes an embedding layer and a graph structure encoder. The embedding layer is used to map the optimized numerical identifier sequence to a high-dimensional space and output the code text representation vector. The graph structure encoder is used to aggregate the structural dependencies between code terms in the code term sequence based on the optimized adjacency matrix and output the graph representation vector.

[0087] Thus, the optimized numerical identifier sequence is mapped to a text representation vector carrying code semantics based on the embedding layer, and the structural dependencies between code terms in the code term sequence are aggregated based on the graph structure encoder to generate a graph representation vector representing the structural features of the code, thereby achieving accurate extraction of code semantic and structural information.

[0088] In some embodiments, locating abnormal code blocks from the source code to be detected based on graph representation vectors and code text representation vectors includes: inputting graph representation vectors and code text representation vectors into a pre-trained abnormal code detection model, outputting a classification result corresponding to each code block in the source code to be detected; and determining the abnormal code blocks in the source code to be detected based on the classification result corresponding to each code block in the source code to be detected.

[0089] The pre-trained abnormal code detection model can consist of a multilayer perceptron and a SoftMax classifier. By inputting the graph representation vector and the code text representation vector into the pre-trained abnormal code detection model, the model can output the classification result corresponding to each code block. Based on the classification result corresponding to each code block in the source code to be detected, the abnormal code blocks in the source code to be detected are determined.

[0090] The classification result is a binary classification result, which indicates whether the code block has an anomaly or not.

[0091] In some embodiments, graph representation vectors and code text representation vectors can be fused, such as by concatenating or weighting the graph representation vectors and code text representation vectors to obtain a fused representation vector. This fused representation vector is then input into a pre-trained multilayer perceptron in an abnormal code detection model. Through multilayer nonlinear transformations (such as using the ReLU activation function in the hidden layers), key features related to anomalies (such as missing null pointer checks, array out-of-bounds risks, etc.) are extracted. The output layer of the multilayer perceptron generates a two-dimensional vector (corresponding to "abnormal" and "normal" classes respectively), which is then converted into a normalized probability distribution by a SoftMax classifier (the sum of the two probability values ​​is 1). Finally, the classification is determined based on the probability results: if the probability of the "abnormal" class is greater than a preset threshold, the code block is predicted to be a code block with an abnormal risk; otherwise, it is determined to be a non-abnormal code block. The entire process achieves accurate binary classification of code anomaly risks by comprehensively considering the semantic and structural features of the code, leveraging the feature extraction capabilities of the multilayer perceptron and the probability normalization of SoftMax.

[0092] In practical applications, for identified abnormal code blocks, in addition to locating the abnormal code region of the abnormal code block through the self-attention mechanism, other Local Interpretable Model-Agnostic Explanations (LIME) techniques can be used to score the abnormal code statements, thereby determining the abnormal code region of the abnormal code block.

[0093] Local interpretability techniques refer to using trained local surrogate models to interpret individual samples. For example, interpretable models such as linear regression and decision trees can be used to interpret black-box models like neural networks. Specifically, for the same input within a local scope, we want the outputs of the interpretable model and the black-box model to be as close as possible. It's crucial to emphasize the concept of "local scope" here, because while interpretable models like linear models cannot actually simulate the entire black-box model like a neural network, they can simulate a local region within it. This is why local interpretability techniques can score anomalies in candidate code within at least one candidate code region of an anomaly code module.

[0094] Currently, local interpretability techniques can include: gradient attribution interpretability, DeepLift (model interpretability) interpretability, SHAP (SHapley Additive exPlanation, a machine learning model interpretability tool) interpretability, and integral gradient interpretability.

[0095] Among them, gradient attribution interpretability technology calculates the impact of the perturbation of each lexical on the final result, which is called calculating the gradient. Therefore, the larger the calculated gradient, the greater the impact of the perturbation of that lexical on the final result. In the abnormal code localization method, this can be interpreted as the greater contribution of the abnormal code region to the risk of an anomaly occurring in the abnormal code block.

[0096] DeepLift interpretable technology compares reference features with lexical terms given a reference feature and assigns a contribution score based on the comparison difference. The larger the contribution score, the greater the impact of the lexical perturbation on the final result. In the abnormal code localization method, this can be interpreted as the greater contribution of the abnormal code region to the risk of an anomaly occurring in the abnormal code block.

[0097] SHAP interpretability technology constructs an additive interpretive model, treating all input features as "contributors." It calculates the marginal contribution of a feature when added to the interpretive model, then averages these marginal contributions across all feature sequences; this average is the SHAP value of that feature. A higher SHAP value indicates a greater impact of the lexical perturbation on the final result. In anomaly code localization methods, this can be interpreted as a greater contribution of the anomaly code region to the risk of anomalies occurring in the anomaly block.

[0098] The integral gradient interpretability technique is to determine the anomaly score of candidate code regions by calculating the integral gradient in multiple dimensions. The larger the anomaly score, the greater the impact of the lexical perturbation on the final result. In the anomaly code localization method, this can be interpreted as the greater contribution of the anomaly code region to the anomaly risk of the anomaly block.

[0099] Furthermore, in order to combine the code semantic representation ability of the software source code vulnerability prediction model (abnormal code detection model) based on code text learning and the code structure representation ability of the software source code vulnerability prediction model based on graph representation learning, this application uses a graph-guided attention transformer encoder module (GATE) to combine graph attention and text learning to more fully represent code information.

[0100] For the ease of understanding of those skilled in the art, Figure 2 An architecture diagram is provided for implementing an exception code location method. For example... Figure 2 As shown, the architecture includes a heterogeneous discrete code graph (HDCG), a graph-guided attention transformer encoder (GATE), and GATE-based fine-grained defect localization (FINDGATE).

[0101] The heterogeneous discrete code graph (HDCG) is used to capture hidden dependencies in code, such as syntax, control flow, and data flow. Its input can be the source code to be tested. By extracting an Abstract Syntax Tree (AST), the syntactic hierarchy of the code (such as nested relationships between functions, statements, and expressions) is parsed. Further subgraphs such as the Control Flow Graph (CFG) are extracted from the AST to capture the execution path of the code (such as if-else statements and loop jump logic). Mapping and Merge are used to map the code tokens of the code to be tested to the leaf nodes of the graph, fusing multiple graph structures (AST, CFG, Data Flow Graph (DFG), etc.) to finally construct the HDCG. Here, "heterogeneous" refers to the fusion of multiple types of code graphs, and "discrete" means that the nodes of the graph are the smallest semantic units of the code (tokens or structural nodes).

[0102] The input to GATE can include the input embedding and positional encoding of the code lexical sequence, as well as the adjacency matrix generated by HDCG. The input embedding and positional encoding are obtained by converting lexical units into high-dimensional vectors and adding positional information, corresponding to the code text representation vector in the above embodiment. The adjacency matrix is ​​determined by encoding the structural dependencies between nodes in the code graph (such as whether two lexical units have syntactic or control flow associations), corresponding to the graph representation vector in the above embodiment.

[0103] Graph-guided Self-attention – Building upon the self-attention mechanism of Transformers, this approach introduces an adjacency matrix of a graph structure to guide attention allocation, allowing the model to focus more on key parts of the code structure (such as variables that depend on data flow or key branches of control flow).

[0104] The encoder layer includes weighted add, Add&Norm (residual connection + layer normalization), Feed Forward, and Add&Norm. This is used to implement the processes of attention fusion, feature stabilization, non-linear enhancement, and feature re-stabilization, ensuring that graph structure information and code semantics can be effectively integrated and transmitted.

[0105] Output: Function-level prediction (anomaly prediction) is achieved using a multilayer perceptron (MLP) and a softmax classifier to determine whether a code block contains defects (anomalies).

[0106] The graph attention-guided code encoder module is designed to adapt to structured input of software source code for source code analysis and learn code structure information. Therefore, it employs a sequence-to-sequence model, an improvement on the Transformer encoder, to encode the input code token sequence. Compared to some recent fusion mechanisms based on Transformer models attempting code structure learning, the GATE model does not introduce additional sequences into the input, ensuring its adaptability to different code lengths.

[0107] In terms of input embedding, the code word sequence T is converted into a numerical ID sequence (numerical identifier sequence) X through a lookup table mapping relationship, and the numerical identifier sequence is pruned or padded to make its length reach the set parameter. And it is embedded into a high-dimensional space through an embedding layer. middle.

[0108] The numerical identifier sequence X is pruned or padded according to its length:

[0109]

[0110] in, Characterizes the optimized numerical identifier sequence obtained after cropping or padding.

[0111] Meanwhile, the adjacency matrix Perform the same cropping or filling as well:

[0112]

[0113] in, The optimized adjacency matrix is ​​represented by the result of trimming or padding.

[0114] For software source code vulnerability prediction models based on self-attention mechanisms, such as Transformer, the self-attention mechanism itself can be used to locate high-risk code vulnerabilities. In software source code vulnerability representation models based on self-attention mechanisms, the self-attention layer is used to calculate the attention weight of each code tag, thereby generating an attention vector.

[0115] The generated attention weights are used to indicate which code statements the model should focus on. Typically, self-attention mechanisms are used to capture global dependencies, where attention weights represent how each code token in a code lexicon sequence is affected by all other code tokens in the same sequence, thereby capturing the dependencies between each code token and generating more meaningful code representations.

[0116] The attention mechanism can be represented as:

[0117]

[0118] in, In terms of self-attention, it means making ,Right now ,in It is the input sequence of code tokens. The self-attention mechanism employs the concept of information retrieval, using dot product operations to calculate the relevance score of each code token, where each token interacts with every other token once. Through self-attention, attention weights can be generated within the sequence to find connections within the sequence. The advantage of the attention layer is that it can capture global connections in one step because it directly compares each pair of sequences (at the cost of increased computational cost). In contrast, RNNs need to iterate step by step to capture the information, while CNNs need to expand the receptive field through layering, which is a clear advantage of Attention layers.

[0119] Among them, FINDGATE input is the multi-view attentions output by GATE - including attention weights for different views such as original words, leaf nodes, CFG, DFG, etc., which encode the degree of attention the model pays to each part of the code. Its processing flow includes layer-by-layer score aggregation: through Layers Add (accumulating the attention weights output by each attention layer of the model), Tokens scores (calculating the self-attention score corresponding to each code token), Leaves Add (mapping the token scores to the leaf nodes of the code graph (such as the leaf nodes of the Abstract Syntax Tree (AST), corresponding to the smallest semantic unit of the code) and accumulating them to achieve feature aggregation from tokens to graph nodes), and Statements Add (further aggregating the leaf node scores to the statement level, calculating the defect risk score of each code statement, obtaining the self-attention score corresponding to each code statement, and locating the scope of the defective statement), the attention weights are gradually aggregated from the token level to the statement level; multi-view weighted fusion (Views Weighted Add): weighted fusion of scores from different graph views (such as CFG, DFG) is performed to finally output statement-level prediction—precisely locating which specific statement has a defect (abnormality).

[0120] Thus, this approach covers the entire process of code structure understanding, function-level (code block) defect prediction, and statement-level defect localization across three levels: High-Definition Code Coding (HDCG), Multimodal Coding (GATE), and Fine-Grained Localization (FINDGATE). By combining the sequential semantics of code (text modeling, which Transformer excels at) and structural dependencies (relational modeling, which graph models excel at), it improves the accuracy of defect prediction and precisely locates defect positions, providing clear guidance for code auditing and remediation.

[0121] In another embodiment, such as Figure 3 As shown, an exception code location method is provided. Taking the application of this method to a computer device as an example, the method includes the following steps:

[0122] Step S302: The source code to be detected is split into a sequence of code tokens. According to the pre-built word list mapping relationship, a corresponding numerical identifier is assigned to each code token in the sequence of code tokens to obtain a sequence of numerical identifiers.

[0123] Step S304: Obtain the adjacency matrix corresponding to the code lexical sequence, optimize the numerical identifier sequence and the adjacency matrix to obtain the optimized numerical identifier sequence and the optimized adjacency matrix.

[0124] Step S306: Input the optimized numerical label sequence and the optimized adjacency matrix into the pre-trained graph attention-guided code encoder, and output the code text representation vector and graph representation vector.

[0125] Step S308: Input the graph representation vector and the code text representation vector into the pre-trained abnormal code detection model, and output the classification result corresponding to each code block in the source code to be detected.

[0126] Step S310: Based on the classification results corresponding to each code block in the source code to be detected, determine the abnormal code blocks in the source code to be detected.

[0127] Step S312: Obtain the attention weight information of each code word in any code statement at each self-attention layer.

[0128] Step S314: Sum the attention weights assigned to each code word in each self-attention layer to determine the self-attention score corresponding to each code word in any code statement.

[0129] Step S316: Determine the self-attention score of any code statement based on the self-attention score of each code lexical in any code statement.

[0130] Step S318: Determine the abnormal code region of the abnormal code block based on the self-attention score corresponding to each code statement in the abnormal code block.

[0131] It should be noted that the specific limitations of the above steps can be found in the specific limitations of an exception code location method described above.

[0132] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0133] Based on the same inventive concept, this application also provides an exception code location device for implementing the exception code location method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more exception code location device embodiments provided below can be found in the limitations of the exception code location method described above, and will not be repeated here.

[0134] In one exemplary embodiment, such as Figure 4 As shown, an exception code location device is provided, including: a vector acquisition module 410, a location module 420, a score determination module 430, and an exception determination module 440, wherein:

[0135] The vector acquisition module 410 is used to acquire the graph representation vector and code text representation vector corresponding to the source code to be detected; the graph representation vector is used to represent the code structure corresponding to the source code to be detected; the code text representation vector is used to represent the code semantics corresponding to the source code to be detected; the source code to be detected includes at least one code block; each code block includes at least one code statement.

[0136] The positioning module 420 is used to locate the abnormal code block from the source code to be detected based on the graph representation vector and the code text representation vector.

[0137] The score determination module 430 is used to determine the self-attention score corresponding to each code statement in the abnormal code block through a self-attention mechanism; the self-attention score is used to characterize the degree of influence of the corresponding code statement on the prediction that the abnormal code block is abnormal.

[0138] The exception determination module 440 is used to determine the abnormal code region of the abnormal code block based on the self-attention score corresponding to each code statement in the abnormal code block.

[0139] In one embodiment, each code statement includes at least one code term; the score determination module 430 is specifically configured to, for any code statement, obtain the self-attention score corresponding to each code term in the any code statement; and determine the self-attention score corresponding to the any code statement based on the self-attention score corresponding to each code term in the any code statement.

[0140] In one embodiment, the score determination module 430 is specifically used to obtain the attention weight information corresponding to each code word in each self-attention layer in any code statement; the attention weight information corresponding to any code word includes the attention weight assigned to each code word in any code statement; the attention weights assigned to each code word in each self-attention layer are summed to determine the self-attention score corresponding to each code word in any code statement.

[0141] In one embodiment, the vector acquisition module 410 is specifically used to split the source code to be detected into a sequence of code lexical units, assign a corresponding numerical identifier to each code lexical unit in the sequence of code lexical units according to a pre-constructed word list mapping relationship, and obtain a numerical identifier sequence; obtain the adjacency matrix corresponding to the code lexical unit sequence, optimize the numerical identifier sequence and the adjacency matrix, and obtain an optimized numerical identifier sequence and an optimized adjacency matrix; the lengths of the optimized numerical identifier sequence and the optimized adjacency matrix meet a preset condition; and determine the graph representation vector and code text representation vector corresponding to the source code to be detected based on the optimized numerical identifier sequence and the optimized adjacency matrix.

[0142] In one embodiment, the vector acquisition module 410 is specifically used to input the optimized numerical identifier sequence and the optimized adjacency matrix into a pre-trained graph attention-guided code encoder, and output the code text representation vector and the graph representation vector; wherein, the pre-trained graph attention-guided code encoder includes an embedding layer and a graph structure encoder; the embedding layer is used to map the optimized numerical identifier sequence to a high-dimensional space and output the code text representation vector; the graph structure encoder is used to aggregate the structural dependencies between code terms in the code term sequence based on the optimized adjacency matrix and output the graph representation vector.

[0143] In one embodiment, the localization module 420 is specifically used to input the graph representation vector and the code text representation vector into a pre-trained abnormal code detection model, output the classification result corresponding to each code block in the source code to be detected, and determine the abnormal code block in the source code to be detected based on the classification result corresponding to each code block in the source code to be detected.

[0144] Each module in the aforementioned exception code location device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0145] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements an exception code location method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0146] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0147] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0148] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0149] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0150] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0151] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0152] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0153] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. An abnormal code positioning method, characterized by, The method comprises: obtaining a graph representation vector and a code text representation vector corresponding to the to-be-detected source code; the graph representation vector is used to represent the code structure corresponding to the to-be-detected source code; the code text representation vector is used to represent the code semantics corresponding to the to-be-detected source code; the to-be-detected source code comprises at least one code block; each code block comprises at least one code statement; locating an abnormal code block from the to-be-detected source code according to the graph representation vector and the code text representation vector; determining a self-attention score corresponding to each code statement in the abnormal code block through a self-attention mechanism; the self-attention score is used to represent the influence degree of the corresponding code statement on the abnormal code block being predicted to have an anomaly; determining an abnormal code region of the abnormal code block according to the self-attention score corresponding to each code statement in the abnormal code block.

2. The method of claim 1, wherein, Each code statement comprises at least one code token; the self-attention score corresponding to each code statement in the abnormal code block is determined through a self-attention mechanism, comprising: for any code statement, obtaining a self-attention score corresponding to each code token in the any code statement; determining a self-attention score corresponding to the any code statement according to the self-attention score corresponding to each code token in the any code statement.

3. The method of claim 2, wherein, The self-attention score corresponding to each code token in the any code statement is obtained for any code statement, comprising: obtaining attention weight information corresponding to each code token in the any code statement at each self-attention layer; the attention weight information corresponding to any code token comprises an attention weight allocated to the any code token by each code token in the any code statement; summing the attention weight allocated to each code token in each self-attention layer to determine the self-attention score corresponding to each code token in the any code statement.

4. The method of claim 1, wherein, The graph representation vector and the code text representation vector corresponding to the to-be-detected source code are obtained, comprising: splitting the to-be-detected source code into a code token sequence, and assigning a corresponding numerical identifier to each code token in the code token sequence according to a pre-constructed word table mapping relationship to obtain a numerical identifier sequence; obtaining an adjacency matrix corresponding to the code token sequence, and performing optimization processing on the numerical identifier sequence and the adjacency matrix to obtain an optimized numerical identifier sequence and an optimized adjacency matrix; the length of the optimized numerical identifier sequence and the optimized adjacency matrix satisfies a preset condition; determining the graph representation vector and the code text representation vector corresponding to the to-be-detected source code according to the optimized numerical identifier sequence and the optimized adjacency matrix.

5. The method of claim 4, wherein, The graph representation vector and the code text representation vector corresponding to the to-be-detected source code are determined according to the optimized numerical identifier sequence and the optimized adjacency matrix, comprising: inputting the optimized numerical identifier sequence and the optimized adjacency matrix into a pre-trained code encoder based on graph attention guidance to output the code text representation vector and the graph representation vector; The pre-trained code encoder based on graph attention guidance includes an embedding layer and a graph structure encoder; the embedding layer is configured to map the optimized numerical identifier sequence to a high-dimensional space, and output the code text representation vector; and the graph structure encoder is configured to aggregate structural dependency relationships between code tokens in the code token sequence based on the optimized adjacency matrix, and output the graph representation vector.

6. The method of claim 1, wherein, The locating of the abnormal code block from the to-be-detected source code according to the graph representation vector and the code text representation vector includes: inputting the graph representation vector and the code text representation vector into a pre-trained abnormal code detection model, and outputting a classification result corresponding to each code block in the to-be-detected source code; determining the abnormal code block in the to-be-detected source code according to the classification result corresponding to each code block in the to-be-detected source code.

7. An abnormal code positioning apparatus characterized by comprising: The apparatus includes: a vector obtaining module configured to obtain a graph representation vector and a code text representation vector corresponding to a to-be-detected source code; the graph representation vector is configured to represent a code structure corresponding to the to-be-detected source code; the code text representation vector is configured to represent a code semantics corresponding to the to-be-detected source code; the to-be-detected source code includes at least one code block; and each code block includes at least one code statement; a locating module configured to locate an abnormal code block from the to-be-detected source code according to the graph representation vector and the code text representation vector; a score determining module configured to determine a self-attention score corresponding to each code statement in the abnormal code block by a self-attention mechanism; the self-attention score is configured to represent an influence degree of the corresponding code statement on the abnormal code block being predicted as abnormal; an abnormality determining module configured to determine an abnormal code region of the abnormal code block according to the self-attention score corresponding to each code statement in the abnormal code block.

8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automatic exception processing method for source codes

    CN112035347A

  • Source code vulnerability detection method and system with interpretability

    CN117725589A

  • Fine-grained vulnerability detection method and system based on semantic perception sparse attention

    CN119622735A

  • Code detection method, electronic equipment and computer readable medium

    CN119622750A

Cited By

  • Abnormity detection and repair method and system for big data task and medium

    CN121743130A