Code vulnerability detection method and electronic equipment

By performing multimodal analysis on the source code, constructing multidimensional feature vectors, and fusing them, the problem of insufficient accuracy of traditional tools in identifying code vulnerabilities is solved, achieving higher detection accuracy and a lower false alarm rate.

CN121615145APending Publication Date: 2026-03-06INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202610125308.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-29
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Traditional code analysis tools struggle to accurately identify code vulnerabilities, especially in complex software systems where they cannot effectively identify common vulnerabilities such as buffer overflows and null pointer accesses.

Method used

By performing syntactic analysis, parsing, and static analysis on the source code, multimodal and multidimensional feature vectors are constructed, and weighted fusion and classification bias processing are performed to generate multidimensional fused vectors to identify vulnerabilities.

Benefits of technology

It improves the accuracy of vulnerability detection, reduces the false positive rate, and can comprehensively identify the syntactic features, syntactic structure, logical relationships and data dependencies of the code, making up for the limitations of single-modal analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121615145A_ABST
    Figure CN121615145A_ABST
Patent Text Reader

Abstract

The invention discloses a code vulnerability detection method and electronic equipment, and relates to the technical field of code security, a multi-modal multi-dimensional feature vector is constructed through multi-modal information of a source code, vector fusion is performed to obtain a multi-dimensional fusion vector, and classification bias processing is performed on the multi-dimensional fusion vector to obtain a first result. Through the first result, the grammar composition feature, the grammar structure, the logic relationship and the data dependence of the code can be understood at the same time, so that the vulnerability is comprehensively identified, the limitation of single-modal analysis is made up, the accuracy of vulnerability detection is improved, and the false alarm rate is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of code security technology, and in particular to a code vulnerability detection method and electronic device. Background Technology

[0002] In software development and maintenance, detecting code security vulnerabilities is a crucial step in ensuring system stability and data security. For example, in high-security fields such as industrial control systems, financial trading platforms, and medical equipment, developers need to conduct rigorous vulnerability testing after writing the code to prevent common vulnerabilities such as buffer overflows, null pointer access, and privilege escalation from being maliciously exploited.

[0003] With the increasing complexity of software and the diversification of attack methods, traditional code analysis tools are no longer sufficient to meet the needs of accurate vulnerability identification. Summary of the Invention

[0004] This application provides a code vulnerability detection method and electronic device to improve the accuracy of code vulnerability detection.

[0005] Firstly, this application provides a code vulnerability detection method, including:

[0006] Obtain the source code to be tested;

[0007] The source code to be tested is subjected to syntactic analysis to obtain text modal information, which indicates the syntactic features of the source code; the source code to be tested is subjected to syntactic parsing to obtain structural modal information, which indicates the syntactic structure of the source code; and the source code to be tested is subjected to static analysis to obtain semantic modal information, which indicates the execution path and data dependencies of the program corresponding to the source code.

[0008] Mapping and related processing are performed on text modal information, structural modal information, and semantic modal information respectively to obtain multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors;

[0009] The multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector are weighted and fused to obtain the first multidimensional fused vector;

[0010] The first multidimensional fusion vector is subjected to classification bias processing to obtain the first result, which indicates the probability that the source code to be detected has a vulnerability.

[0011] Secondly, this application provides a code vulnerability detection device, comprising:

[0012] The acquisition module is used to acquire the source code to be detected.

[0013] The analysis module is used to perform syntactic analysis on the source code to be tested, to obtain text modal information, which indicates the syntactic features of the source code; to perform syntactic parsing on the source code to be tested, to obtain structural modal information, which indicates the syntactic structure of the source code; and to perform static analysis on the source code to be tested, to obtain semantic modal information, which indicates the execution path and data dependencies of the program corresponding to the source code.

[0014] The mapping processing module is used to perform mapping-related processing on text modal information, structural modal information and semantic modal information respectively to obtain multidimensional text vectors, multidimensional structural vectors and multidimensional semantic vectors;

[0015] The fusion module is used to perform weighted fusion of multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors to obtain the first multidimensional fused vector;

[0016] The classification bias processing module is used to perform classification bias processing on the first multi-dimensional fusion vector to obtain a first result, which indicates the probability that the source code to be detected has a vulnerability.

[0017] Thirdly, this application provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of the above-described code vulnerability detection method when executing the computer program.

[0018] Fourthly, this application provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the above-described code vulnerability detection method.

[0019] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described code vulnerability detection method.

[0020] This application provides a code vulnerability detection method and electronic device. It constructs a multimodal, multidimensional feature vector using multimodal information from source code and fuses these vectors to obtain a multidimensional fused vector. The multidimensional fused vector is then subjected to classification bias processing to obtain a first result. This first result allows for the simultaneous understanding of the code's syntactic features, syntactic structure, logical relationships, and data dependencies, thereby comprehensively identifying vulnerabilities. This overcomes the limitations of single-modal analysis, improves the accuracy of vulnerability detection, and reduces the false positive rate. Attached Figure Description

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

[0022] Figure 1 Flowchart of the code vulnerability detection method provided in this application Figure 1 ;

[0023] Figure 2 Flowchart of the code vulnerability detection method provided in this application Figure 2 ;

[0024] Figure 3 Flowchart of the code vulnerability detection method provided in this application Figure 3 ;

[0025] Figure 4 This application provides a structural diagram of code vulnerability detection.

[0026] Figure 5 A schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0028] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0029] The code vulnerability detection method provided in this application constructs multimodal, multidimensional feature vectors from the multimodal information of the source code and performs vector fusion to obtain a multidimensional fused vector. This multidimensional fused vector is then subjected to classification bias processing to obtain a first result. This first result allows for the simultaneous understanding of the code's syntactic features, syntactic structure, logical relationships, and data dependencies, thereby comprehensively identifying vulnerabilities. This overcomes the limitations of single-modal analysis, improves the accuracy of vulnerability detection, and reduces the false positive rate.

[0030] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0031] Figure 1 Flowchart of the code vulnerability detection method provided in this application Figure 1 ,like Figure 1 As shown, it includes the following steps:

[0032] S101. Obtain the source code to be tested.

[0033] This application is applicable to scenarios such as software development, security auditing, and code deduplication, and is especially suitable for fields with extremely high security requirements, such as industrial control systems, financial trading platforms, and medical devices.

[0034] The execution subject of this application embodiment can be an electronic device in the above-mentioned scenario or field, or a code vulnerability detection device installed in the electronic device. The code vulnerability detection device can be implemented by software or by a combination of software and hardware.

[0035] The source code to be tested can refer to source code that can be statically analyzed and / or parsed. This source code is in a readable text format and conforms to the syntax of the corresponding programming language.

[0036] For example, the source code to be detected can be compiled language code (such as C code, C++ code, Java code, C# code), interpreted language code (such as Python code, JavaScript code / Node.js code, PHP code), script or configuration class code (such as Shell code, Perl code, Lua code, YAML code / JSON code), blockchain or smart contract class code (such as Solidity code, Move code). This application does not limit the programming language of the source code to be detected.

[0037] For example, the source code to be detected can be complete source code, code snippets, function-level code, project-level code, incremental code, etc. This application does not limit the form in which the source code to be detected exists.

[0038] For example, the source code to be detected can be open source or third-party dependent code, uncompiled or unformatted raw code, pseudo code or decompiled code, etc. This application does not limit the scenario or state of the source code to be detected.

[0039] S102. Perform syntactic analysis on the source code to be detected to obtain text modal information, which indicates the syntactic features of the source code to be detected; perform syntactic parsing on the source code to be detected to obtain structural modal information, which indicates the syntactic structure of the source code to be detected; perform static analysis on the source code to be detected to obtain semantic modal information, which indicates the path and data dependencies of the program corresponding to the source code to be detected during execution.

[0040] "Performing syntactic analysis on the source code to be tested to obtain text modality information" can refer to: using a parser to extract the original character sequence from the source code to be tested, focusing on natural language information such as variable names, function names, and comments.

[0041] The main functions of a parser are: (1) to identify various syntactic elements in the source code to be tested (such as keywords, identifiers, operators or punctuation, function names, literals, etc.); and (2) to convert unstructured source code text into structured token sequences that can be processed by programs (such as compilers and code analysis tools). That is, through parsing, readable source code text can be converted into a structured token sequence that can be processed by a machine.

[0042] Syntactic features can include the composition and order of the smallest semantic units.

[0043] "Syntax parsing the source code to be tested to obtain structural modality information" can refer to using a syntax parsing tool to extract structural modality information from the source code. This structural modality information can include the syntax hierarchy and structure of the code. For example, the structural modality information can be an abstract syntax tree.

[0044] Syntax parsing tools can convert readable source code text into a structured intermediate representation that can be processed by a machine, such as an abstract syntax tree or a list of syntax units, according to the syntax rules of the corresponding programming language. In other words, syntax parsing can transform linear source code text into hierarchical structural information.

[0045] "Performing static analysis on the source code to be tested to obtain semantic modality information" can refer to using a static analysis engine to construct semantic modality information. For example, semantic modality information can be a code attribute graph.

[0046] The following examples illustrate text modal information, structural modal information, and semantic modal information.

[0047] For example, the source code to be detected is shown below:

[0048] void process_user_input(char *user_input) {

[0049] char buffer

[256] ;

[0050] strcpy(buffer, user_input);

[0051] printf("%s", buffer);

[0052] }

[0053] Text modality information is extracted from the source code to be detected using a parser. The text modality information is as follows:

[0054] ['void','process_user_input','(','char','*','user_input',')','{','char','buffer','[','256',']',' ;','strcpy','(','buffer',',','user_input',')',';','printf','(','"','%s','"','buffer',')',';','}']

[0055] Structural modality information is extracted from the source code to be tested using a syntax parsing tool. The structural modality information is as follows:

[0056] FunctionDefinition

[0057] ├──type:void

[0058] ├──name:"process_user_input"

[0059] ├──parameters:

[0060] │ └── ParameterDeclaration

[0061] │ ├──type:char*

[0062] │ └──name:"user_input"

[0063] └── body:CompoundStatement

[0064] ├──LocalVariableDeclaration

[0065] │ ├──type:char

[256]

[0066] │ └──name:"buffer"

[0067] └──ExpressionStatement

[0068] └──CallExpression

[0069] ├──callee:Identifier("strcpy")

[0070] └──arguments:

[0071] ├──Identifier("buffer")

[0072] └──Identifier("user_input")

[0073] The information above shows that strcpy is the internal calling function of process_user_input, buffer and user_input are the two actual parameters of this function call, and buffer is an array within the function.

[0074] Semantic modality information is constructed using a static analysis engine. The semantic modality information is as follows:

[0075] DataFlow:

[0076] user_input[external_untrusted]→strcpy(src)

[0077] buffer[stack_fixed_256]→strcpy(dest)

[0078] ControlFlow:

[0079] entry→strcpy→printf→exit

[0080] Security Facts:

[0081] external_input(user_input)=true

[0082] buffer_size_fixed(buffer) = 256

[0083] dangerous_function(strcpy)=true

[0084] data_validation_missing(user_input)=true

[0085] S103. Perform mapping-related processing on the text modal information, structural modal information, and semantic modal information respectively to obtain multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors.

[0086] Multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors have the same dimension. For example, multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors can all be three-dimensional vectors. This application does not impose any restrictions on the dimension of text vectors, multidimensional structural vectors, and multidimensional semantic vectors.

[0087] Multidimensional text vectors, multidimensional structure vectors, and multidimensional semantic vectors can represent different features of the source code to be detected. For example, multidimensional text vectors represent the natural language features of the source code to be detected, multidimensional structure vectors represent the syntactic structure features of the source code to be detected, and multidimensional semantic vectors represent the data flow and control flow features of the source code to be detected.

[0088] In one possible implementation, text modal information, structural modal information, and semantic modal information can be mapped and processed separately to obtain multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors: N vector dimensions are determined, where N is a positive integer; based on a bimodal pre-trained language model and the N vector dimensions, the text modal information is quantized, mapped, and fused to obtain multidimensional text vectors with a dimension of N; based on a structural encoder and the N vector dimensions, the structural modal information is subjected to first key feature extraction, quantization, mapping, and fusion to obtain multidimensional structural vectors, where the first key feature includes at least one of the following: node type, operator semantics, variable type, dangerous function label, context depth, and subtree complexity, and the multidimensional structural vector has a dimension of N; based on a graph encoder and the N vector dimensions, the semantic modal information is subjected to second key feature extraction, quantization, mapping, and fusion to obtain multidimensional semantic vectors, where the second key feature includes at least one of the following: control flow criticality, number of nested loops, and anomaly handling branch label, and the multidimensional semantic vector has a dimension of N.

[0089] A bimodal pre-trained language model can be the CodeBERT model.

[0090] For example, suppose the three vector dimensions are: Dimension 1, whether the operation is risky (the higher the value, the more dangerous); Dimension 2, whether the data source is trustworthy (the higher the value, the more trustworthy); Dimension 3, whether there are corresponding protective measures (the higher the value, the more adequate the protection). For any character in the text modal information, the character is quantized into a three-dimensional vector based on the three vector dimensions. Suppose that "strcpy" in the text modal information can be quantized as [0.9, 0.1, 0.2], which means that it is a dangerous operation, the source is untrustworthy, and there are few protective measures. The same applies to other characters. The three-dimensional vectors corresponding to all characters in the text modal information are linearly combined to obtain a multi-dimensional text vector, such as [0.8, 0.1, 0.1].

[0091] For example, “linearly combining the three-dimensional vectors corresponding to all characters in the text modal information” could mean: assigning weights to each character based on the actual situation, and then weighting and summing the three-dimensional vectors corresponding to each character based on their respective weights to obtain a multi-dimensional text vector.

[0092] The following example illustrates how to extract, quantize, map, and fuse the first key feature of structural modal information to obtain a multidimensional structural vector.

[0093] For example, assuming there are 3 vector dimensions, "extracting, quantizing, mapping, and fusing the first key features of structural modal information to obtain a multi-dimensional structural vector" can refer to: extracting the first key features strongly correlated with the 3 vector dimensions from the structural modal information and clarifying the specific manifestation of each first key feature; quantizing the extracted first key features into numerical values ​​according to the "three-dimensional vector dimensions" (0 = none / low, 1 = high); and integrating all quantized feature values ​​under each dimension into a final value through mean or weighted summation to finally obtain a unified three-dimensional structural vector.

[0094] The structural encoder can be a Tree-LSTM, and this application does not impose any restrictions on it. Assume the three vector dimensions are: Dimension 1, whether the operation is risky (higher values ​​indicate greater risk); Dimension 2, whether the data source is trustworthy (higher values ​​indicate greater trustworthiness); Dimension 3, whether there are corresponding protective measures (higher values ​​indicate more adequate protection). If the multidimensional structural vector is [0.7, 0.2, 0.3], it indicates that there is a dangerous operation in the structure, the data source is not very trustworthy, and the protection is insufficient.

[0095] For example, assuming there are three vector dimensions, "extracting, quantizing, mapping, and fusing second key features of semantic modality information to obtain a multidimensional structural vector" can refer to: extracting second key features strongly correlated with the three vector dimensions from the semantic modality information and clarifying the specific manifestation of each second key feature; quantizing the extracted second key features into numerical values ​​according to the "three-dimensional vector dimensions" (0 = none / low, 1 = high); and integrating all quantized feature values ​​under each dimension into a final value through mean or weighted summation to finally obtain a unified three-dimensional semantic vector.

[0096] The graph encoder can be a GAT tool, and this application does not limit it. Assume that the three vector dimensions are: Dimension 1, whether the operation is risky (the higher the value, the more dangerous); Dimension 2, whether the source of the data is trustworthy (the higher the value, the more trustworthy); Dimension 3, whether there are corresponding protection measures (the higher the value, the more adequate the protection); if the multidimensional semantic vector is [0.9,0.0,0.0], it represents an extremely dangerous data flow, the data is completely untrustworthy, and there is no protection.

[0097] Multidimensional vectors can transform the "latent features" of vulnerabilities into "computable numerical features," significantly improving the accuracy, efficiency, and generalization ability of vulnerability identification.

[0098] S104. Perform weighted fusion on the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector to obtain the first multidimensional fusion vector.

[0099] The weights of each vector can be preset, and the vectors can be linearly combined based on their weights to obtain the first multidimensional fusion vector.

[0100] In one possible implementation, a first multidimensional fusion vector can be obtained by weighted fusion of multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors as follows: determine the first weight corresponding to the multidimensional text vector, the second weight corresponding to the multidimensional structural vector, and the third weight corresponding to the multidimensional semantic vector; and perform a weighted summation of the multidimensional text vector, multidimensional structural vector, and multidimensional semantic vector based on the first weight, the second weight, and the third weight to obtain the first multidimensional fusion vector.

[0101] The weights of each vector can be dynamically adjusted. For example, the first, second, and third weights can be dynamically adjusted based on the key contextual features of the source code to be detected. The first, second, and third weights can also be dynamically adjusted based on other actual situations; this application does not impose any restrictions on this.

[0102] Assuming the weights are evenly distributed, i.e., the first weight is 0.33, the second weight is 0.33, and the third weight is 0.33, the multidimensional text vector is [0.8,0.1,0.1], the multidimensional structure vector is [0.7,0.2,0.3], and the multidimensional semantic vector is [0.9,0.0,0.0], then the first multidimensional fusion vector can be: 0.33 × [0.8,0.1,0.1] + 0.33 × [0.7,0.2,0.3] + 0.33 × [0.9,0.0,0.0] = [0.264,0.033,0.033] + [0.231,0.066,0.099] + [0.297,0.0,0.0] = [0.792,0.099,0.132].

[0103] S105. Perform classification bias processing on the first multidimensional fusion vector to obtain the first result, which indicates the probability that the source code to be detected has a vulnerability.

[0104] Classification bias processing can include classification bias operations and normalization operations. Through classification bias operations, the numerical distribution or dimensional weights of the first multidimensional fusion vector can be adjusted.

[0105] exist Figure 1 In the illustrated embodiment, a multimodal multidimensional feature vector is constructed using the multimodal information of the source code, and vector fusion is performed to obtain a multidimensional fused vector. This multidimensional fused vector is then subjected to classification bias processing to obtain a first result. This first result allows for a simultaneous understanding of the code's syntactic features, syntactic structure, logical relationships, and data dependencies, thereby comprehensively identifying vulnerabilities. This overcomes the limitations of single-modal analysis, improves the accuracy of vulnerability detection, and reduces the false positive rate.

[0106] exist Figure 1 Based on the illustrated embodiment, the following is combined with Figure 2 The technical solution of this application is described in detail.

[0107] Figure 2 Flowchart of the code vulnerability detection method provided in this application Figure 2 ,like Figure 2 As shown, it includes the following steps:

[0108] S201. Obtain the source code to be tested.

[0109] S202. Perform syntactic analysis on the source code to be detected to obtain text modal information, which indicates the syntactic features of the source code to be detected; perform syntactic parsing on the source code to be detected to obtain structural modal information, which indicates the syntactic structure of the source code to be detected; perform static analysis on the source code to be detected to obtain semantic modal information, which indicates the path and data dependencies of the program corresponding to the source code to be detected during execution.

[0110] S203. Perform mapping-related processing on the text modal information, structural modal information, and semantic modal information respectively to obtain multidimensional text vectors, multidimensional structural vectors, and multidimensional semantic vectors.

[0111] It should be noted that the execution process of S201 to S203 can be referred to the execution process of S101 to S103, and will not be repeated here.

[0112] S204. Determine the first weight corresponding to the multidimensional text vector, the second weight corresponding to the multidimensional structure vector, and the third weight corresponding to the multidimensional semantic vector.

[0113] In one possible implementation, the first weight, the second weight, and the third weight can be determined in the following manner:

[0114] Obtain multiple source code samples; obtain the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector corresponding to each source code sample from the multiple source code samples, forming a multidimensional text vector set, a multidimensional structure vector set, and a multidimensional semantic vector set; determine the variance of the multidimensional text vector set, the multidimensional structure vector set, and the multidimensional semantic vector set in each dimension, respectively, to obtain the text variance vector, the structure variance vector, and the semantic variance vector; sum the elements in the text variance vector to obtain the total text variance; sum the elements in the structure variance vector to obtain the total structure variance; sum the elements in the semantic variance vector to obtain the total semantic variance; determine the first weight, the second weight, and the third weight based on the total text variance, the total structure variance, and the total semantic variance.

[0115] It should be noted that this application does not limit the number of source code samples. For obtaining the multidimensional text vectors, multidimensional structure vectors, and multidimensional semantic vectors corresponding to the source code samples, please refer to... Figure 1 The corresponding descriptions in the illustrated embodiments will not be repeated here.

[0116] A multidimensional text vector set can also be called a text vector matrix, a multidimensional structure vector set can also be called a structure vector matrix, and a multidimensional semantic vector set can also be called a semantic vector matrix.

[0117] For example, if the number of source code samples is 1000 and the dimension of each multidimensional vector is 64, then the size of the text vector matrix, the structure vector matrix, and the semantic vector matrix is ​​1000×64.

[0118] In one possible implementation, the first weight, the second weight, and the third weight can be determined based on the total text variance, the total structural variance, and the total semantic variance in the following manner:

[0119] The total variance is determined based on the total text variance, total structural variance, and total semantic variance. The proportion of the total text variance in the total variance is determined as the first weight, the proportion of the total structural variance in the total variance is determined as the second weight, and the proportion of the total semantic variance in the total variance is determined as the third weight.

[0120] The sum of the total variances is calculated as follows: total text variance + total structural variance + total semantic variance = total variance.

[0121] The following examples illustrate how to determine the first, second, and third weights.

[0122] Assuming there are 3 source code samples, and each multidimensional vector has a dimension of 2, the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector corresponding to the 3 source code samples are shown in the table below:

[0123]

[0124] The multidimensional text vector set has values ​​of [1,2,3] in dimension 1, with a mean of 2 and a variance of ((1-2)²+(2-2)²+(3-2)²) / 3 = 2 / 3 ≈ 0.667; the multidimensional text vector set has values ​​of [2,3,4] in dimension 2, with a mean of 3 and a variance of 2 / 3 ≈ 0.667; the multidimensional structure vector set has values ​​of [3,4,5] in dimension 1, with a mean of 4 and a variance of 2 / 3 ≈ 0.667; the multidimensional structure vector set has values ​​of [4,5,6] in dimension 2, with a mean of 5 and a variance of 2 / 3 ≈ 0.667; the multidimensional semantic vector set has values ​​of [5,7,9] in dimension 1, with a mean of 7 and a variance of ((5-7)²+(7-7)²+(9-7)²) / 3 = 8 / 3. ≈ 2.667; The multidimensional semantic vector set has values ​​of [6,8,10] in dimension 2, with a mean of 8 and a variance of 8 / 3 ≈2.667.

[0125] The total text variance is 0.667 + 0.667 ≈ 1.334; the total structural variance is 0.667 + 0.667 ≈ 1.334; the total semantic variance is 2.667 + 2.667 ≈ 5.334. The sum of the total variances is 1.334 + 1.334 + 5.334 ≈ 8.002.

[0126] First weight = 1.334 / 8.002 ≈ 0.167; Second weight = 1.334 / 8.002 ≈ 0.167; Third weight = 5.334 / 8.002 ≈ 0.667.

[0127] S205. Based on the first weight, the second weight, and the third weight, the multidimensional text vector, the multidimensional structure vector, and the multidimensional semantic vector are weighted and summed to obtain the first multidimensional fusion vector.

[0128] S206. Obtain the preset classification weight matrix and preset bias value.

[0129] The preset classification weight matrix can be determined based on the weight values ​​of the aforementioned multiple multidimensional vectors.

[0130] For example, the preset classification weight matrix is ​​K=[(-1,1)(1,-1)(1,-1)], and the preset bias value is b=[0.1,-0.1].

[0131] S207. Based on the first multidimensional fusion vector, the preset classification weight matrix, and the preset bias value, determine the second multidimensional fusion vector. The dimension of the second multidimensional fusion vector is smaller than that of the first multidimensional fusion vector.

[0132] In one possible implementation, the first multidimensional fusion vector, the preset classification weight matrix, the preset bias value, and the second multidimensional fusion vector satisfy the following formula:

[0133] S=K × H f + b

[0134] Where S is the second multidimensional fusion vector, K is the preset classification weight matrix, and H is the second multidimensional fusion vector. f is the first multidimensional fusion vector, and b is the preset bias value.

[0135] For example, suppose the three vector dimensions are: Dimension 1, whether the operation is risky (higher values ​​indicate greater risk); Dimension 2, whether the data source is trustworthy (higher values ​​indicate greater trustworthiness); Dimension 3, whether there are corresponding protective measures (higher values ​​indicate more adequate protection). The weights of the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector are evenly distributed, i.e., the first weight is 0.33, the second weight is 0.33, and the third weight is 0.33. The multidimensional text vector is: [0.8, 0.1, 0.1], the multidimensional structure vector is: [0.7, 0.2, 0.3], and the multidimensional semantic vector is: [0.9, 0.0, 0.0]. Then the first multidimensional fusion vector can be: [0.792, 0.099, 0.132]. The preset classification weight matrix is ​​K=[(-1,1)(1,-1)(1,-1)], and the preset bias value is b=[0.1, -0.1]. Then the second multidimensional fusion vector S = [-0.792 × 1 + 0.099 × 1 + 0.132 × 1 + 0.1, 0.792 × 1 + (-0.099) × 1 + (-0.132) × 1 - 0.1] = [-0.461, 0.461].

[0136] S208. The second multidimensional fusion vector is converted into the first result by a normalized exponential function.

[0137] The normalization exponential function can be the Softmax function.

[0138] For example, [-0.461, 0.461] can be converted to [0.284, 0.716] using a normalization function, which means that the probability of the source code being tested having a vulnerability is 71.6%, and the probability of not having a vulnerability is 28.4%.

[0139] As the vector dimension increases and the vector weights are adjusted, the results will become more accurate.

[0140] exist Figure 2 In the illustrated embodiment, by combining the syntactic features, syntactic structure, logical relationships, and data dependencies of the code, the accuracy of vulnerability detection is improved, and false positives caused by differences in coding style are reduced. For example, during the security audit phase of software development, buffer overflow vulnerabilities in C language code can be detected automatically.

[0141] Based on the above, the following will combine... Figure 3 The technical solution of this application is described in detail.

[0142] Figure 3 Flowchart of the code vulnerability detection method provided in this application Figure 3 ,like Figure 3 As shown, it includes the following steps:

[0143] S301. Obtain the source code to be tested.

[0144] S302. Perform syntactic analysis on the source code to be detected to obtain text modal information, which indicates the syntactic features of the source code to be detected; perform syntactic parsing on the source code to be detected to obtain structural modal information, which indicates the syntactic structure of the source code to be detected; perform static analysis on the source code to be detected to obtain semantic modal information, which indicates the path and data dependencies of the program corresponding to the source code to be detected.

[0145] S303. Perform mapping-related processing on the text modal information, structural modal information and semantic modal information respectively to obtain multidimensional text vector, multidimensional structural vector and multidimensional semantic vector.

[0146] S304. Determine the first weight corresponding to the multidimensional text vector, the second weight corresponding to the multidimensional structure vector, and the third weight corresponding to the multidimensional semantic vector.

[0147] It should be noted that the execution process of S301 to S304 can be referred to the execution process of S201 to S204, and will not be repeated here.

[0148] S305. Obtain multiple key contextual features of the source code to be detected.

[0149] Contextual key features of source code refer to quantitative features that can reflect the attributes, business scenarios, or information value of the source code to be tested.

[0150] For example, several key contextual features may include: cyclomatic complexity, textual information density, structural information density, semantic information density, and risk level. Cyclomatic complexity can refer to the number of logical branches or loops in the source code, reflecting structural or semantic complexity. Textual information density can refer to the proportion of keywords in the source code, reflecting the information value of the textual modality. Structural information density can refer to the depth or number of nodes in the abstract syntax tree, reflecting the information value of the structural modality. Semantic information density can refer to the number of data dependency edges or control flow paths, reflecting the information value of the semantic modality. The risk level reflects the degree of risk of the business to which the source code belongs.

[0151] It should be noted that this application does not impose restrictions on the contextual key features of the source code.

[0152] S306. Based on multiple key contextual features of the source code to be detected, dynamically adjust the first weight, second weight, and third weight.

[0153] In one possible implementation, the first weight, second weight, and third weight can be dynamically adjusted based on multiple contextual key features of the source code to be detected in the following manner:

[0154] Multiple contextual key features are normalized to obtain multiple key feature values. A text modality adjustment factor is determined based on the key feature values ​​related to the text modality. A structural modality adjustment factor is determined based on the key feature values ​​related to the structural modality. A semantic modality adjustment factor is determined based on the key feature values ​​related to the semantic modality. The first weight is adjusted based on the text modality adjustment factor, the second weight is adjusted based on the structural modality adjustment factor, and the third weight is adjusted based on the semantic modality adjustment factor. The adjusted first, second, and third weights are then normalized to obtain the final first, second, and third weights.

[0155] Since multiple key contextual features may have different dimensions (e.g., cyclomatic complexity 0-20, risk level 1-3), it is necessary to normalize these features first. If the multiple key contextual features have the same dimension, normalization may not be necessary.

[0156] For example, assuming the cyclomatic complexity ranges from 0 to 20, and the cyclomatic complexity of the source code to be detected is 8, then the key feature value after normalization is: (8-0) / (20-0) = 0.4.

[0157] The adjustment factor is a weight correction coefficient for each mode. The larger the adjustment factor, the higher the weight of that mode will be; the smaller the adjustment factor, the lower the weight of that mode will be.

[0158] In determining the adjustment factor, the range of the adjustment factor can be limited to avoid over-adjustment.

[0159] For example, assume that the normalized text information density is 0.2, the cyclomatic complexity is 0.6, the structural information density is 0.5, the semantic information density is 0.7, and the risk level is 1.0 (high risk).

[0160] Since the text modality adjustment factor depends only on the text information density, assuming a baseline of 1.0 and a fluctuation of ±0.5, the text modality adjustment factor is: 1.0 + (0.2 - 0.5) × 1.0 = 0.7.

[0161] Since the structural modality adjustment factor depends on the cyclomatic complexity and structural information density, assuming a baseline of 1.0 and a fluctuation of ±0.6, the structural modality adjustment factor is: 1.0 + (0.6 + 0.5 - 1.0) × 0.6 = 1.06.

[0162] Since the semantic modality adjustment factor depends on cyclomatic complexity, semantic information density, and risk level, assuming a baseline of 1.0, a fluctuation of ±0.8, and an adjustment factor range of [0.2, 1.8], the semantic modality adjustment factor is: 1.0 + (0.6 + 0.7 + 1.0 - 0.5) × 0.8 = 2.44, with a cutoff of 1.8.

[0163] The values ​​within parentheses, -0.5 and -1.0, represent offsets to ensure that the feature mean corresponds to an adjustment factor of 1.0. The coefficients multiplied after the parentheses, 1.0, 0.6, and 0.8, represent sensitivity; the larger these coefficients are, the more significant the impact of feature changes on the adjustment factor.

[0164] Adjusting weights using an adjustment factor can mean weight × adjustment factor.

[0165] For example, assuming the initial first weight is 0.227, the second weight is 0.327, the third weight is 0.446, the text modality adjustment factor is 0.7, the structural modality adjustment factor is 1.06, and the semantic modality adjustment factor is 1.8, then the adjusted first weight is 0.227 × 0.7 = 0.1589, the adjusted second weight is 0.327 × 1.06 = 0.3466, and the adjusted third weight is 0.446 × 1.8 = 0.8028. After normalizing the three adjusted weights, the final first weight is 0.1589 / (0.1589+0.3466+0.8028)≈0.121, the final second weight is 0.3466 / (0.1589+0.3466+0.8028)≈0.265, and the final third weight is 0.8028 / (0.1589+0.3466+0.8028)≈0.614.

[0166] S307. Based on the final first weight, second weight, and third weight, the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector are weighted and summed to obtain the first multidimensional fusion vector.

[0167] S308. Obtain the preset classification weight matrix and preset bias value.

[0168] S309. Based on the first multidimensional fusion vector, the preset classification weight matrix, and the preset bias value, determine the second multidimensional fusion vector. The dimension of the second multidimensional fusion vector is smaller than that of the first multidimensional fusion vector.

[0169] S310. The second multidimensional fusion vector is converted into the first result by a normalized exponential function.

[0170] It should be noted that the execution process of S307 to S310 can be referred to the execution process of S205 to S208, and will not be repeated here.

[0171] Figure 3 The embodiments shown, in addition to possessing the technical effects of the embodiments described above, can further improve the accuracy and robustness of code vulnerability detection by dynamically adjusting the weights.

[0172] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0173] Figure 4 A schematic diagram of the code vulnerability detection structure provided in this application. (For example...) Figure 4 As shown, the code vulnerability detection device 400 includes: an acquisition module 401, an analysis module 402, a mapping processing module 403, a fusion module 404, and a classification bias processing module 405.

[0174] Module 401 is used to acquire the source code to be detected;

[0175] Analysis module 402 is used to perform syntactic analysis on the source code to be detected to obtain text modal information, which indicates the syntactic features of the source code to be detected; perform syntactic parsing on the source code to be detected to obtain structural modal information, which indicates the syntactic structure of the source code to be detected; and perform static analysis on the source code to be detected to obtain semantic modal information, which indicates the path and data dependencies of the program corresponding to the source code to be detected during execution.

[0176] The mapping processing module 403 is used to perform mapping-related processing on text modal information, structural modal information and semantic modal information respectively to obtain multidimensional text vectors, multidimensional structural vectors and multidimensional semantic vectors;

[0177] The fusion module 404 is used to perform weighted fusion of multidimensional text vectors, multidimensional structural vectors and multidimensional semantic vectors to obtain the first multidimensional fusion vector;

[0178] The classification bias processing module 405 is used to perform classification bias processing on the first multi-dimensional fusion vector to obtain a first result, which indicates the probability that the source code to be detected has a vulnerability.

[0179] In one possible implementation, the mapping processing module 403 is specifically used for:

[0180] Determine N vector dimensions, where N is a positive integer;

[0181] Based on a bimodal pre-trained language model and N vector dimensions, text modal information is quantized, mapped, and fused to obtain multidimensional text vectors with N dimensions.

[0182] Based on the structural encoder and N vector dimensions, the structural modal information is subjected to first key feature extraction, quantization mapping and fusion to obtain a multi-dimensional structural vector. The first key feature includes at least one of the following: node type, operator semantics, variable type, dangerous function label, context depth, subtree complexity, and the dimension of the multi-dimensional structural vector is N.

[0183] Based on a graph encoder and N vector dimensions, the semantic modality information is subjected to second key feature extraction, quantization mapping and fusion to obtain a multidimensional semantic vector. The second key feature includes at least one of the following: control flow keyness, number of nested loops, and anomaly handling branch label. The dimension of the multidimensional semantic vector is N.

[0184] In one possible implementation, the fusion module 404 is specifically used for:

[0185] Determine the first weight corresponding to the multidimensional text vector, the second weight corresponding to the multidimensional structural vector, and the third weight corresponding to the multidimensional semantic vector;

[0186] Based on the first weight, the second weight, and the third weight, the multidimensional text vector, the multidimensional structure vector, and the multidimensional semantic vector are weighted and summed to obtain the first multidimensional fusion vector.

[0187] In one possible implementation, the fusion module 404 is specifically used for:

[0188] Obtain multiple source code samples;

[0189] Obtain the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector corresponding to each source code sample from multiple source code samples, and form a multidimensional text vector set, a multidimensional structure vector set, and a multidimensional semantic vector set.

[0190] The variances of the multidimensional text vector set, multidimensional structure vector set, and multidimensional semantic vector set in each dimension are determined respectively, resulting in text variance vector, structure variance vector, and semantic variance vector;

[0191] The total text variance is obtained by summing the elements in the text variance vector; the total structural variance is obtained by summing the elements in the structural variance vector; and the total semantic variance is obtained by summing the elements in the semantic variance vector.

[0192] The first weight, second weight, and third weight are determined based on the total text variance, total structural variance, and total semantic variance.

[0193] In one possible implementation, the fusion module 404 is specifically used for:

[0194] The total variance is determined based on the total text variance, total structural variance, and total semantic variance.

[0195] The proportion of the total text variance in the total variance sum is determined as the first weight, the proportion of the total structural variance in the total variance sum is determined as the second weight, and the proportion of the total semantic variance in the total variance sum is determined as the third weight.

[0196] In one possible implementation, the fusion module 404 is also used for:

[0197] Obtain multiple key contextual features of the source code to be detected;

[0198] The first, second, and third weights are dynamically adjusted based on multiple contextual key features.

[0199] In one possible implementation, the fusion module 404 is specifically used for:

[0200] Multiple key contextual features are normalized separately to obtain multiple key feature values;

[0201] Based on the key feature values ​​related to text modality among multiple key feature values, determine the text modality adjustment factor; based on the key feature values ​​related to structural modality among multiple key features, determine the structural modality adjustment factor; based on the key feature values ​​related to semantic modality among multiple key features, determine the semantic modality adjustment factor.

[0202] The first weight is adjusted based on the text modality adjustment factor, the second weight is adjusted based on the structural modality adjustment factor, and the third weight is adjusted based on the semantic modality adjustment factor.

[0203] The adjusted first, second, and third weights are normalized to obtain the final first, second, and third weights.

[0204] In one possible implementation, the classification bias processing module 405 is specifically used for:

[0205] Obtain the preset classification weight matrix and preset bias values;

[0206] Based on the first multidimensional fusion vector, the preset classification weight matrix, and the preset bias value, a second multidimensional fusion vector is determined, wherein the dimension of the second multidimensional fusion vector is smaller than that of the first multidimensional fusion vector.

[0207] The second multidimensional fusion vector is converted into the first result by using a normalized exponential function.

[0208] In one possible implementation, the first multidimensional fusion vector, the preset classification weight matrix, the preset bias value, and the second multidimensional fusion vector satisfy the following formula:

[0209] S=K × H f + b

[0210] Where S is the second multidimensional fusion vector, K is the preset classification weight matrix, and H is the second multidimensional fusion vector. f is the first multidimensional fusion vector, and b is the preset bias value.

[0211] For a description of the features in the embodiment corresponding to the code vulnerability detection device, please refer to the relevant description of the embodiment corresponding to the code vulnerability detection method, which will not be repeated here.

[0212] Figure 5 A schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 500 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the electronic device 500 further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus.

[0213] In the specific implementation process, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to execute the above-described code vulnerability detection method embodiment.

[0214] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0215] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0216] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0217] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0218] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described code vulnerability detection method embodiments at runtime.

[0219] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0220] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described code vulnerability detection method embodiments.

[0221] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the code vulnerability detection method embodiments described above.

[0222] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0223] The above provides a detailed description of a code vulnerability detection method provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method of detecting code vulnerabilities, the method comprising: The method comprises the following steps: acquiring source code to be detected; performing syntax analysis on the source code to be detected to obtain text modality information, the text modality information indicating syntax composition characteristics of the source code to be detected; performing syntax parsing on the source code to be detected to obtain structure modality information, the structure modality information being used to indicate syntax structure of the source code to be detected; performing static analysis on the source code to be detected to obtain semantic modality information, the semantic modality information indicating path and data dependency relationship when a program corresponding to the source code to be detected is executed; respectively performing mapping-related processing on the text modality information, the structure modality information and the semantic modality information to obtain a multi-dimensional text vector, a multi-dimensional structure vector and a multi-dimensional semantic vector; performing weighted fusion on the multi-dimensional text vector, the multi-dimensional structure vector and the multi-dimensional semantic vector to obtain a first multi-dimensional fusion vector; performing classification bias processing on the first multi-dimensional fusion vector to obtain a first result, the first result indicating a probability of existence of a vulnerability in the source code to be detected.

2. The method of claim 1, wherein, The method comprises the following steps: determining N vector dimensions, N being a positive integer; based on a double-modality pre-training language model and the N vector dimensions, performing quantitative mapping and fusion on the text modality information to obtain the multi-dimensional text vector, the multi-dimensional text vector having N dimensions; based on a structure encoder and the N vector dimensions, performing first key feature extraction, quantitative mapping and fusion on the structure modality information to obtain the multi-dimensional structure vector, the first key feature including at least one of the following: node type, operator semantics, variable type, dangerous function marker, context depth and sub-tree complexity, the multi-dimensional structure vector having N dimensions; based on a graph encoder and the N vector dimensions, performing second key feature extraction, quantitative mapping and fusion on the semantic modality information to obtain the multi-dimensional semantic vector, the second key feature including at least one of the following: control flow key degree, loop nesting layer number and exception handling branch marker, the multi-dimensional semantic vector having N dimensions.

3. The method of claim 1, wherein, The method comprises the following steps: determining a first weight corresponding to the multi-dimensional text vector, a second weight corresponding to the multi-dimensional structure vector and a third weight corresponding to the multi-dimensional semantic vector; based on the first weight, the second weight and the third weight, performing weighted summation on the multi-dimensional text vector, the multi-dimensional structure vector and the multi-dimensional semantic vector to obtain the first multi-dimensional fusion vector.

4. The method of claim 3, wherein, The method comprises the following steps: acquiring a plurality of source code samples; Obtain the multidimensional text vector, multidimensional structure vector, and multidimensional semantic vector corresponding to each source code sample in the plurality of source code samples, and form a multidimensional text vector set, a multidimensional structure vector set, and a multidimensional semantic vector set; The variances of the multidimensional text vector set, the multidimensional structure vector set, and the multidimensional semantic vector set in each dimension are determined respectively to obtain the text variance vector, the structure variance vector, and the semantic variance vector. The total text variance is obtained by summing the elements in the text variance vector; the total structural variance is obtained by summing the elements in the structural variance vector; and the total semantic variance is obtained by summing the elements in the semantic variance vector. The first weight, the second weight, and the third weight are determined based on the total text variance, the total structural variance, and the total semantic variance.

5. The method of claim 4, wherein, The step of determining the first weight, the second weight, and the third weight based on the total text variance, the total structural variance, and the total semantic variance includes: The total variance is determined based on the total text variance, the total structural variance, and the total semantic variance; The proportion of the total text variance in the total variance sum is determined as the first weight, the proportion of the total structural variance in the total variance sum is determined as the second weight, and the proportion of the total semantic variance in the total variance sum is determined as the third weight.

6. The method of claim 3, wherein, The method further includes: Obtain multiple key contextual features of the source code to be detected; The first weight, the second weight, and the third weight are dynamically adjusted based on the multiple contextual key features.

7. The method of claim 6, wherein, The step of dynamically adjusting the first weight, the second weight, and the third weight based on the multiple contextual key features includes: The multiple contextual key features are normalized to obtain multiple key feature values; Based on the key feature values ​​related to text modality among the multiple key feature values, a text modality adjustment factor is determined; based on the key feature values ​​related to structural modality among the multiple key features, a structural modality adjustment factor is determined; based on the key feature values ​​related to semantic modality among the multiple key features, a semantic modality adjustment factor is determined. The first weight is adjusted according to the text modality adjustment factor, the second weight is adjusted according to the structural modality adjustment factor, and the third weight is adjusted according to the semantic modality adjustment factor; The adjusted first, second, and third weights are normalized to obtain the final first, second, and third weights.

8. The method according to any one of claims 1 to 7, characterized in that, The step of performing classification bias processing on the first multidimensional fusion vector to obtain a first result includes: Obtain the preset classification weight matrix and preset bias values; A second multidimensional fusion vector is determined based on the first multidimensional fusion vector, the preset classification weight matrix, and the preset bias value. The dimension of the second multidimensional fusion vector is smaller than that of the first multidimensional fusion vector. The second multidimensional fusion vector is converted into the first result by using a normalized exponential function.

9. The method of claim 8, wherein, The first multidimensional fusion vector, the preset classification weight matrix, the preset bias value, and the second multidimensional fusion vector satisfy the following formula: S = K x H f + b Wherein, S is the second multi-dimensional fusion vector, K is the preset classification weight matrix, H f is the first multi-dimensional fusion vector, and b is the preset bias value.

10. An electronic device, comprising: include: a memory for storing a computer program; a processor for implementing the steps of the code vulnerability detection method according to any one of claims 1 to 9 when executing the computer program.

Citation Information

Patent Citations

  • Security vulnerability detection method and device, computer program product and storage medium

    CN120805148A

  • Application software code defect automatic detection method and system based on artificial intelligence

    CN121255641A

  • Software vulnerability detection method based on code standardization and cross-modal semantic collaboration

    CN121412994A