Data processing method and device, electronic equipment and storage medium

By analyzing variable change chains across compilation units and identifying similarity of historical annotation false alarm information, the problems of low testing accuracy and high false alarm rate in existing technologies are solved, achieving more efficient and accurate data testing.

CN114329471BActive Publication Date: 2026-01-02BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111618202.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2026-01-02
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

Existing technologies do not consider global changes when testing data in compilation units, resulting in low test accuracy and a high false alarm rate. In particular, the false alarm rate for division by zero reaches 34%, which increases labor costs and maintenance difficulty.

Method used

By introducing the identification and parsing of function call relationships and variable change relationships across compilation units, combined with monitoring global changes of variables through variable change chains, and utilizing historical annotation false alarm information for similarity identification, the false alarm rate is reduced and the test accuracy is improved.

Benefits of technology

It improved the accuracy of data testing, reduced whitelist setup and manual costs, lowered the false positive rate, and improved the overall efficiency and accuracy of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114329471B_ABST
    Figure CN114329471B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data processing method and device, electronic equipment and storage medium, relates to the technical field of data testing, in particular to the technical field of code testing, to at least solve the technical problem of low accuracy in related technologies for testing data. The specific implementation scheme is: obtaining to-be-tested data; testing the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether to intercept the to-be-tested data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data testing, in particular to the technical field of code testing, and especially to a data processing method and device, an electronic device, and a storage medium. BACKGROUND

[0002] Currently, in the process of testing data in each compilation unit, each compilation unit is tested respectively, and when testing data in each compilation unit, the efficiency of testing is improved by means of exemption whitelist and manual annotation of false positive problems, but this process does not consider global changes, which leads to low accuracy of testing. SUMMARY

[0003] The present disclosure provides a data processing method and device, an electronic device, and a storage medium to at least solve the technical problem of low accuracy of testing data in related technologies.

[0004] According to an aspect of the present disclosure, a data processing method is provided, comprising: obtaining to-be-tested data; testing the to-be-tested data based on target data and a variable change chain in the to-be-tested data, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether to intercept the to-be-tested data.

[0005] According to another aspect of the present disclosure, a data processing device is provided, comprising: an obtaining module configured to obtain to-be-tested data; and a testing module configured to test the to-be-tested data based on target data and a variable change chain in the to-be-tested data, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether to intercept the to-be-tested data.

[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the data processing method provided by the present disclosure.

[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the data processing method provided by the present disclosure.

[0008] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, and the computer program is used to enable a processor to execute the data processing method provided by the present disclosure.

[0009] In the present disclosure, first, the to-be-tested data is acquired, and then the to-be-tested data is tested based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether the to-be-tested data is intercepted, and the change of the variable in the whole can be monitored through the variable change chain, so as to identify the risk that the target data in the to-be-tested data is 0, thereby improving the accuracy of the test. In addition, by testing the to-be-tested data in combination with the variable change chain, it is not necessary to separately set a whitelist for a certain test module for detection, which can reduce the setting of the whitelist, reduce the cost of the test, and further improve the accuracy of the test, so as to at least solve the technical problem of low accuracy of data testing in the related art.

[0010] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0011] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:

[0012] Figure 1 is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a data processing method according to an embodiment of the present disclosure;

[0013] Figure 2 is a flow chart of a data processing method according to an embodiment of the present disclosure;

[0014] Figure 3 is a schematic diagram of similarity recognition according to an embodiment of the present disclosure;

[0015] Figure 4 is a structure block diagram of an overall architecture according to an embodiment of the present disclosure;

[0016] Figure 5 is a structure block diagram of a data processing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0017] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.

[0018] It is to be understood that the terms "first", "second", and the like, used in the description and the claims of the present disclosure as well as the foregoing drawings of the related subject matter are used to distinguish between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of data so designated is not meant to limit the scope of the embodiments of the present disclosure described herein to a given embodiment, but is to "cover" wherever it occurs under the right of the patent law. Furthermore, the terms "comprising" and "including" and any of their derivatives, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or apparatus that comprises a list of steps or units is not necessarily limited to those steps or units that are clearly listed, but can include other steps or units not expressly listed or inherent to such process, method, product, or apparatus.

[0019] Static code scanning is a white-box level static analysis program source code tool, which can quickly locate potential or obvious errors in the code after the code development is completed, improve the development efficiency; and can find security vulnerabilities that cannot be found by manual work, and improve the code quality. At present, the widely used scanning tools in C / C++ are Pc-lint (static code detection tool) and Cppcheck (code defect static checking tool), etc. Pc-lint is a paid software, and its configuration is complex and has high limitations in use; Cppcheck is a free open source software, which supports the customization of checking policy and has stronger extensibility.

[0020] Although the static code checking tool based on Cppcheck can efficiently and quickly intercept code problems, it also has some drawbacks, such as due to the limitation of human experience and cognitive definition in formulating rules, with the high-speed iteration of business, the rules need to cover more and more scenes, resulting in strong dependence of the rules on manual upgrading of the rules, increasing the cost of manual work; and the problem interception is not connected with the false positive information marked by manual work, which will cause the same type of false positive problem to be reported many times, affecting the accuracy of the rules.

[0021] The highest false positive in the static code checking rules is the check of the risk of divisor being 0, with a false positive rate of 34%. Although the rule of division by 0 can intercept most of the division by 0 risk problems, a large number of false positives also greatly reduce the user experience. The main reasons affecting the accuracy of the division by 0 rule are: 1) the denominator style is diverse and the value is greatly affected by the previous information, and the implementation of the rule relies on human experience, which cannot exhaust all risky operations / non-risky operations, resulting in limited coverage of the rule for risky code; 2) and a large number of manual false positive information (manual determination of non-risky problems through analysis of code and business) is not reasonably utilized, resulting in frequent reporting of the same type of problem, increasing the cost of manual marking and affecting user experience.

[0022] Specifically, the static code scanning based on Cppcheck is to generate token stream abstract code of all characters, including character strings, types, etc. according to the lexical and syntax characteristics of C / C++, and to generate an abstract syntax tree to establish a symbol table and record the source program. The scanning tool scans the source code by formulating rules based on the data structure output by cppcheck to find defects and security vulnerabilities in the code.

[0023] Currently, the false positives in the rules are mainly the division by zero problem, with a false positive rate of 34%. The present disclosure focuses on solving the main two problems affecting the accuracy of the division by zero problem:

[0024] 1) cppcheck scans independently for a single compilation unit without considering the global, which cannot cover the function calls across files (non-header files), variable reading and writing across files, resulting in inaccurate variable identification in some scenarios and causing false positives of the rules. In the early stage, in order to solve the inaccurate risk judgment caused by independent compilation units, the main method is to improve it by exemption whitelist and manual labeling, but this increases a lot of manual cost, and large-scale addition of whitelist greatly increases the maintenance cost. Therefore, the present disclosure improves the accuracy of the rule and reduces the manual cost by introducing the identification and analysis of the function call relationship and variable change relationship across the compilation units to predict the risk of division by zero.

[0025] 2) Since the implementation of the rule relies on human experience, it is impossible to exhaust all risky operations / non-risky operations, which limits the coverage of the rule for risky code. And a large number of manual false positives (manual judgment of non-risky problems through code and business analysis) are not reasonably utilized, which causes the same type of problem to be reported frequently, increasing the cost of manual labeling and affecting user experience. Therefore, the present disclosure extracts the code features from the historical manual labeling false positives, and makes similarity judgment between the code features and the newly intercepted problems to filter the bug problems of the same type as the historical false positives, thereby improving the accuracy of the rule.

[0026] The present disclosure mainly predicts the division by zero risk based on the Cppcheck underlying variable information tracking, historical labeling false positive information and C / C++ code characteristics, and identifies the similarity of the problems based on the historical labeling false positive information, thereby improving the interception rate of the rule and reducing the false positive rate.

[0027] According to the embodiments of the present disclosure, a data processing method is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0028] The method embodiments provided by the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal, or a similar electronic device. The electronic device is intended to represent a variety of forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing the data processing method is shown.

[0029] As shown in Figure 1 The computer terminal 100 includes a computing unit 101 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 102 or a computer program loaded into a random access memory (RAM) 103 from a storage unit 108. In the RAM 103, various programs and data required for the operation of the computer terminal 100 can also be stored. The computing unit 101, the ROM 102, and the RAM 103 are connected to each other through a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.

[0030] A plurality of components in the computer terminal 100 are connected to the I / O interface 105, including: an input unit 106, such as a keyboard, a mouse, and the like; an output unit 107, such as various types of displays, speakers, and the like; a storage unit 108, such as a magnetic disk, an optical disk, and the like; and a communication unit 109, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 109 allows the computer terminal 100 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0031] The computing unit 101 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 101 performs the data processing methods described herein. For example, in some embodiments, the data processing methods can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 108. In some embodiments, part or all of the computer program can be loaded and / or installed onto the computer terminal 100 via the ROM 102 and / or the communication unit 109. When the computer program is loaded onto the RAM 103 and executed by the computing unit 101, one or more steps of the data processing methods described herein can be performed. Alternatively, in other embodiments, the computing unit 101 can be configured to perform the data processing methods by any other appropriate means, such as by means of firmware.

[0032] Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0033] It is noted here that, in some optional embodiments, the above-mentioned Figure 1 The electronic device shown can include hardware elements (including circuitry), software elements (including computer code stored on a machine-readable medium), or a combination of both hardware and software elements. It should be noted that Figure 1 is merely one instance of a particular concrete example, and is intended to show the types of components that can be present in the above-described electronic device.

[0034] In the above-described operating environment, the present disclosure provides a data processing method as shown in Figure 2 The method can be performed by a computer terminal as shown in Figure 1 or a similar electronic device.Figure 2 is a data processing method flowchart provided according to an embodiment of the present disclosure. As shown in the figure, the method can include the following steps: Figure 2

[0035] Step S202, obtaining to-be-tested data.

[0036] The to-be-tested data described above can be data in any test unit in the entire test project.

[0037] The to-be-tested data described above can be to-be-tested code.

[0038] In an optional embodiment, the to-be-tested data can be parsed by a source code parsing module to obtain data actually required to be checked in the to-be-tested data. For example, the risk of a divisor being 0 needs to be detected, the to-be-tested data can be parsed by the source code parsing module to determine whether there is a divisor in the to-be-tested data, if there is a divisor, the divisor can be obtained, and the divisor is detected subsequently, so as to exclude the risk of the divisor being 0.

[0039] Step S204, testing the to-be-tested data based on target data in the to-be-tested data and a variable change chain to obtain a first test result.

[0040] The variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether the to-be-tested data is intercepted.

[0041] The target data described above can be a divisor in the to-be-tested data, that is, a denominator in the to-be-tested data.

[0042] The variable change chain described above can record changes of all variables in a global value range, wherein a Node in the variable change chain can be a value of a variable file name, a function name, and a line number granularity. The variable change chain can be used to focus on the value range of a variable in a specified file function, a specified function, and a specified line.

[0043] In an optional embodiment, the target data in the to-be-tested data can be tested by a value range of a variable in the variable change chain, that is, the divisor is tested. Whether the divisor has a risk of being 0 can be determined according to the first test result, if the divisor has a risk of being 0, the to-be-tested data needs to be intercepted, so that the user can repair the to-be-tested data, if the divisor does not have a risk of being 0, the to-be-tested data can be investigated for other risks.

[0044] In another optional embodiment, in order to improve the accuracy of the divisor being 0 problem, a risk prediction strategy can be used before the divisor being 0 check, and the variable change chain generated by Cppcheck is used to perceive the risk in advance based on the C / C++ code structure features.​

[0045] Through the above steps, first, the to-be-tested data is acquired, and then the to-be-tested data is tested based on target data in the to-be-tested data and a variable change chain to obtain a first test result, where the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether the to-be-tested data is intercepted. The variable change chain can be used to monitor the global change of the variable, so as to identify the risk that the target data in the to-be-tested data is 0, thereby improving the accuracy of the test. In addition, the to-be-tested data is tested by combining the variable change chain, without the need to separately set a whitelist for a certain test module for detection, which can reduce the setting of the whitelist, reduce the cost of the test, and further improve the accuracy of the test, thereby at least solving the technical problem of low accuracy of data testing in the related art.

[0046] Optionally, the to-be-tested data is tested based on the target data in the to-be-tested data and the variable change chain to obtain a first test result, including: the to-be-tested data is tested based on the target data in the to-be-tested data and the variable change chain to obtain a second test result, where the second test result is used to indicate whether the target data is a preset constant; in response to the target data not being the preset constant in the second test result, it is determined whether the to-be-tested data meets a preset rule; and in response to the to-be-tested data not meeting the preset rule, the to-be-tested data is tested based on historical labeled data to obtain the first test result.

[0047] The preset constant can be 0. If the divisor is 0, it indicates that the to-be-tested data is incorrect and needs to be repaired.

[0048] The preset rule can be a rule for detecting whether the to-be-tested data has other risks, which is set in advance. For example, defects, security vulnerabilities, and the like in the code.

[0049] In an optional embodiment, the risk that the target data in the to-be-tested data is 0 can be pre-judged based on the target data in the to-be-tested data and the variable change chain, which can be implemented in a risk pre-judgment module. Specifically, it can be determined in the risk pre-judgment module whether the target data in the to-be-tested data is 0. If it is 0, the to-be-tested data can be directly intercepted so that the user can repair the to-be-tested data. If it is not 0, the to-be-tested data can be tested by using a preset rule to determine whether the to-be-tested data meets other preset rules previously formulated. If the to-be-tested data does not meet the preset rule, the to-be-tested data can be compared with historical labeled data to determine whether the to-be-tested data has been marked as not intercepting such problems before. If the historical labeled data is the same as the to-be-tested data, the to-be-tested data can not be intercepted. If they are different, the to-be-tested data can be intercepted, thereby improving the accuracy of data testing.

[0050] Optionally, intercepting the to-be-tested data based on the historical labeled data comprises: performing feature processing on the historical labeled data and the to-be-tested data to obtain historical feature information of the historical labeled data and first feature information of the to-be-tested data, wherein the historical labeled data is used to represent the mis-intercepted data; comparing the first feature information and the historical feature information, and determining target feature information based on a comparison result, wherein the comparison result is used to represent a similarity between the first feature information and the historical feature information, and the target feature information is feature information in the first feature information that has a similarity greater than a preset similarity with the historical feature information; obtaining mis-intercepted test data corresponding to the target feature information; and intercepting other test data in the to-be-tested data except the mis-intercepted test data.

[0051] The historical labeled data described above can be data that has been intercepted before but is confirmed as mis-intercepted by a user, and the mis-intercepted data can be labeled to facilitate subsequent interception of the mis-intercepted data.

[0052] The feature information in the first feature information and the historical feature information described above can include code features, scope information, and non-zero personalized features. The code features can include a service name module_name, a file file, and function information funcname. The scope features include related conditional operations such as if and code block information scope_code. The non-zero personalized features include a divisor tok_str, a function function_name in which the divisor is located, a ternary expression return value is_ternary of the divisor, a variable exp_val of the ternary expression, an operator exp_str, expression 1 exp_1_str, expression 2 exp_2_str, and change chain information value_range of a related variable in the divisor.

[0053] In an optional embodiment, when the to-be-tested data that needs to be intercepted is detected by using a preset rule, the to-be-tested data can be first processed to obtain first feature information. The historical labeled data can be preprocessed and stored in a preset storage location. After the first feature information is obtained, the first feature information can be compared with the pre-stored historical feature information to obtain a comparison result. The target feature information in the first feature information that has a higher similarity with the historical feature information can be determined according to the comparison result. The mis-intercepted test data corresponding to the target feature information can be obtained from the interception items. Data in the to-be-tested data except the mis-intercepted test data can be intercepted to facilitate the user to repair the intercepted data.

[0054] In another optional embodiment, if the task mistakenly intercepts data during the process of repairing the intercepted data, the user can obtain the feature information corresponding to the mistakenly intercepted data and store the feature information in a preset storage location. Alternatively, the user can directly store the mistakenly intercepted data in a preset location to avoid subsequent mistaken interception events of the same problem.

[0055] In yet another alternative embodiment, such as Figure 3 The diagram illustrates similarity recognition. When judging the similarity between test data and historical labeled data, an algorithm combining Simhash and Hamming distance is used to calculate the similarity of features between the test data and historical labeled data. Specifically, the test data is first digitized, and weights are assigned based on the influence of the first feature information on preset rules. The Simhash algorithm is then used to process the first feature information to obtain its signature. The Hamming distance between the first feature information and historical feature information is then calculated based on the binary signature value. If the Hamming distance between the target feature information and historical feature information is less than a preset distance, the similarity between the target feature information and historical feature information is considered greater than the preset similarity. In this case, the target feature information and historical feature information are deemed similar, and the data corresponding to the target feature information is identified as falsely intercepted test data. Falsely intercepted test data can then be removed from the erroneous test data, while other test data besides the falsely intercepted test data can be intercepted.

[0056] It should be noted that the test data may contain one or more sub-data sets to be tested, and the first feature information may contain sub-feature information corresponding to one or more sub-data sets to be tested. The target feature information mentioned above may be feature information with high similarity to historical feature information determined from multiple sub-feature information sets.

[0057] The feature information to be selected can be: "FEATURE_LIST":("file_name","function_name","tok_str","value_range","scope_code"); the weight corresponding to each feature information can be: "WEIGHT_LIST":(20,20,20,40)

[0058] The historical annotation data is as follows:

[0059] function calc(){

[0060] int32_t qc_quanlity_bias=2000;

[0061] uint32_t show_all = ext->show_all();

[0062] uint32_t click_all = ext->click_all();

[0063] float dura_avg = ext->duration_avg();

[0064] float ctr = (click_all + qc_quanlity_bias * exit_ctr) / (show_all + qc_quanlity_bias)

[0065] }

[0066] The test data to be intercepted can be as follows:

[0067] function calc_4(){

[0068] int32_t qc_quanlity_bias = 2000;

[0069] uint32_t show_all = ext->show_all();

[0070] uint32_t click_all = ext->click_all();

[0071] float dura_avg = ext->duration_avg();

[0072] float ctr = (click_all + qc_quanlity_bias * exit_ctr) / (show_all + qc_quanlity_bias)

[0073] }

[0074] The historical feature information corresponding to the historical labeled data can be as follows:

[0075] [u'test.cpp', 'calc_4', u'(show_all+qc_quanlity_bias)', '2000+ext->show_all()']

[0076] The first feature information of the test data to be intercepted can be as follows:

[0077] [u'test.cpp', 'calc', u'(show_all+qc_quanlity_bias)', '2000+ext->show_all()']

[0078] The historical feature information and the first feature information can be converted into fixed-length binary sequences as inputs of the Simhash algorithm.

[0079] The value corresponding to the historical feature information can be as follows: 11011100110010010111110001111000011000100111000100001000011011110101100101001010011100100110111110111111000001000000000101100110100010001000011010001100101010001100001101110001000111011101111111100100000010111010001011101110001010000011000001101110011

[0080] The value corresponding to the to-be-tested data to be intercepted can be as follows: 1101000100010000110100011001010100011000011011100010001110111011101110011001001011111000111100001100010011100010000100001101111010110010100101001110010011011111011111100000100000000010110011100111010010100101101101111001100000001111011100110001100101

[0081] In the Simhash stage, each feature information is weighted based on the weight information, for example, the feature information is an n-dimensional array, for each bit of the array, if the element is 1, it is multiplied by the corresponding weight; if it is 0, it is calculated as -1 multiplied by the corresponding weight; then the elements in the n-dimensional array are summed, and the variable array is obtained, and the part greater than 0 is set to 1 and the part less than 0 is set to 0, thereby obtaining a fixed-length signature value. The hash value after weighting and dimension reduction is as follows:

[0082] The weighted and dimension-reduced value of the historical feature information can be as follows: 110111001100100101111100011110000110001001110001000010000110111100101111110101010111000011001101101111010110011100000100111011110100010001000011010001100101010001100001101110001000111011101111111100100000010111010001011101110001010000011000001101110011

[0083] The weighted and dimension-reduced value of the to-be-tested data to be intercepted is as follows: 110111001100100101111100011110000110001001110001000010000110111100101111110101010111000011001101101111010110011100000100111011110100010001000011010001100101010001100001101110001000111011101111111100100000010111010001011101110001010000011000001101110011

[0084] The to-be-tested data and the historical labeled data are calculated in the same way to obtain signature values of the same length, the Hamming distance between the two is calculated, and the similarity is determined based on the threshold obtained through sample analysis; if the Hamming distance between the two is less than the threshold, it is determined to be similar; otherwise, it is not similar. The final calculated Hamming distance is 55, which is less than the threshold 60 (the threshold is obtained through a large amount of data training), and it is determined to be similar, that is, the to-be-tested data to be intercepted is a false alarm, so the to-be-tested data can not be intercepted.

[0085] It should be noted that in the process of comparing the to-be-tested data with the historical labeled data, each to-be-tested sub-data in the to-be-tested data can be compared with the historical labeled data respectively, so as to determine the false interception test data with a greater similarity to the historical labeled data. The data other than the false interception test data in the to-be-tested data can be intercepted.

[0086] Optionally, the target data in the to-be-tested data and the variable change chain are used to test the to-be-tested data, and a second test result is obtained, including: in response to the target data being a constant, comparing the target data with a preset constant to obtain a comparison result; and in response to the comparison result being that the target data is the preset constant, intercepting the to-be-tested data.

[0087] In an optional embodiment, the target data in the to-be-tested data is a constant, and the target data can be directly compared with 0 to predict the risk. If the target data is 0, it indicates that the to-be-tested data is abnormal, and the to-be-tested data can be intercepted to repair the to-be-tested data.

[0088] Optionally, the target data in the to-be-tested data and the variable change chain are used to test the to-be-tested data, and a second test result is obtained, including: in response to the target data being a constant, comparing the target data with a preset constant to obtain a comparison result; and in response to the comparison result being that the target data is the preset constant, intercepting the to-be-tested data.

[0089] In an optional embodiment, if the target data contains a single variable, the value range of the variable recorded in the variable change chain can be compared with 0 to predict the risk. If 0 exists in the value range of the variable, it indicates that the risk of the divisor being 0 in the to-be-tested data is greater, and the to-be-tested data can be intercepted. If 0 does not exist in the value range of the variable, it indicates that the risk of the divisor being 0 in the to-be-tested data is smaller, and the to-be-tested data can not be intercepted. The variable in the to-be-tested data can be tested in real time by combining the global change of the variable, and the risk of the divisor being 0 can be excluded, thereby improving the accuracy of the test.

[0090] For example, the divisor is a single variable is_single, and the risk is predicted based on the variable change chain.

[0091] The following code:

[0092] function calc_3(){

[0093] unsigned long days_total_seconds=24*60*60;

[0094] unsigned long three_hours_need_seconds=3*60*60;

[0095] pb_sv_msg.svlast_refresh_time()+three_hours_need_seconds) / days_total_seconds

[0096] }

[0097] The variable change chain information is obtained as follows: the divisor days_total_seconds takes the value 86400, which is not 0, and is identified as a false positive, which is not risky. At this time, the test data can not be intercepted.

[0098] Optionally, the test data is tested based on the target data in the test data and the variable change chain, and a second test result is obtained, including: in response to the target data containing a function, the function in the target data is obtained; the value range of the function is determined based on the variable change chain; and the target data is tested based on the value range to obtain the second test result.

[0099] In an optional embodiment, if the target data contains some special functions, such as exp function, pow function, abs function, fabs function, sizeof function, strlen function, etc., because the value ranges of the functions satisfy certain rules, the value range of the function can be estimated according to the variable change chain information, so as to determine the risk of the target data being 0 according to the value range of the function. When 0 exists in the value range, it can be determined that the risk of the target data being 0 is greater, and at this time, the test data can be intercepted. When 0 does not exist in the value range, it can be determined that the risk of the target data being 0 is smaller, and at this time, the test data can not be intercepted. The variable in the test data can be tested in real time in combination with the change of the variable in the whole global, and the risk of the divisor being 0 is excluded, so as to improve the accuracy of the test.

[0100] Optionally, the test data is tested based on the target data in the test data and the variable change chain, and a second test result is obtained, including: in response to the target data containing a first expression, the first expression in the target data is obtained; the first expression is format-converted by using a preset format to obtain a target character; and in response to the target character containing a preset constant, the test data is intercepted.

[0101] The first expression can be a ternary expression. The preset format can be a pre-set uniform format.

[0102] For example, the return value of the divisor can be as follows:

[0103]

[0104] Firstly, the ternary expression can be processed by Fake (a build tool) to uniformly process variables: ('fake_a', u'== 0', '1', 'fake_a') respectively represent (ternary expression value, operator, expression 1, expression 2), if either expression 1 or expression 2 has a value of 0, it is determined to be risky, and the test data to be tested can be intercepted; otherwise, if expression 1 is a constant, expression 2 is a variable and the same as the variable of the relationship expression value, and the relationship operator is not < (< =) greater than 0, it is identified as a false positive, and the test data to be tested can not be intercepted. It can also be similar to the scene of the ternary expression in the historical labeled data, if similar, it is identified as a false positive, at this time, the test data to be tested can not be intercepted. The variable in the test data to be tested can be tested in real time in combination with the global change of the variable, to exclude the risk of division by zero, thereby improving the accuracy of the test.

[0105] For example, the ternary expression in the historical labeled data can be

[0106] ['(subval == 0)? 220 : subval']

[0107] The ternary expression in the test data to be tested can be

[0108] ['tmp == 0? 1 : tmp'].

[0109] The variable in the ternary expression can be uniformly converted to fake_a | fake_b, and the integer greater than 0 can be uniformly converted to 1. After Fake processing, the ternary character is: ('fake_a', u'== 0', '1', 'fake_a'), it is determined that the ternary expression in the test data to be tested is similar to the ternary expression in the historical labeled data, and it is identified as a false positive, at this time, the test data to be tested can not be intercepted.

[0110] Optionally, the test data to be tested is tested based on the target data and the variable change chain in the test data to be tested to obtain a second test result, including: in response to satisfying that the target data contains a second expression, obtaining the second expression in the target data, wherein the number of operator symbols in the second expression is greater than or equal to the number of operator symbols in the first expression; converting the infix expression in the second expression into a postfix expression; calculating the postfix expression based on the variable change chain to obtain a target value; and in response to the target value being less than or equal to a preset constant, intercepting the test data to be tested.

[0111] The second expression described above can be a multi-expression. The multi-expression can contain a ternary expression, and the number of operator symbols in the multi-expression can be greater than or equal to the number of operator symbols in the ternary expression.

[0112] For example, the divisor is a multi-expression:

[0113]

[0114] First, the data can be pre-processed to remove invalid parentheses to obtain (0.01+sqrt(1+click)), then the infix expression result can be converted to a postfix expression: ['0.01', '1', 'click', '+','sqrt', '+'], then the variables in the expression can be replaced according to the variable change chain to obtain: ['0.01', '1', '10', '+','sqrt', '+'], and finally the divisor threshold value can be calculated based on the postfix expression to be greater than 0. It is identified as a risk-free, at this time, the test data can not be intercepted. The combination of the variable change chain can collect global variable information to detect the test data, and improve the test efficiency.

[0115] The overall architecture of the present disclosure can be as shown in Figure 4 The basic components include a source code analysis module, a feature information storage module, a risk prediction module, and a similarity identification module. The source code analysis module is mainly based on cppcheck bottom analysis and tracking of variable information to output the data required in the variable change chain; the feature information module mainly provides basic data for the risk prediction and similarity identification modules; the risk prediction module predicts the risk of the divisor being 0 based on the divisor characteristics and the variable change chain; the similarity identification module mainly identifies whether it is a false positive problem based on historical labeling data, filters false positive problems, and improves the accuracy of the rules.

[0116] As shown in Figure 4 The source code analysis module can perform lexical analysis, syntax analysis, and semantic analysis on the code, wherein the lexical analysis can specifically be creating a doubly linked list Tokenlist for symbolic Tokennizer, the syntax analysis can specifically be abstract syntax tree AST to obtain the syntax tree of each expression, and the semantic analysis can be recording all variables, functions, scopes, etc. in the program to obtain the symbol table SymbolDatabase. The source code analysis module can output the code information, scope information, full-text association information, and variable tracking information of the test data.

[0117] As shown in Figure 4 The feature information of the data can be saved in the database, wherein the feature information includes module information, file information, function information, historical labeling information (i.e. historical labeling data), divisor is a single variable, divisor is a ternary operator, divisor is a multi-expression, divisor is a function return value, divisor string, variable change chain in divisor, condition statement before divisor operation, etc.

[0118] As shown in Figure 4The risk prediction module can first traverse the test data according to the rule check, and select the corresponding execution rule according to the configuration. Various registered Check subclasses, including variables, special functions, expressions, constants, log functions, ternary expressions, single variables, sqrt functions, multi-expression functions, function return values, exp functions, etc.

[0119] As shown in Figure 4 After the risk prediction strategy detects a risk, the test data can be tested in the similarity identification module. Specifically, when judging the similarity between the test data and the historical labeled data, the Simhash algorithm (hash algorithm) and the Hamming distance algorithm are combined to calculate the similarity between the features of the test data and the historical labeled data. Specifically, the test data can be first feature information, and the influence of the first feature information on the preset rule is assigned a corresponding weight. The first feature information is processed using the Simhash algorithm to obtain the signature corresponding to the first feature information. Then, the Hamming distance between the first feature information and the historical feature information is calculated according to the binary signature value, and the result of the similarity judgment is obtained by analyzing the Hamming distance and the pre-set threshold value, so as to exempt the false positive problem. The false positive problem can be collected and then output for display.

[0120] The following lists several typical false positive problems:

[0121] Scenario 1:

Problem False Positive

[0122]

[0123] Scenario 2:

Problem False Positive

[0124]

Historical Label False Positive

[0125]

[0126] Scenario 3:

Problem False Positive

[0127]

[0128]

[0129] Scene 4:

False positive

[0130]

[0131] In order to reduce the probability of the above false positive, first, the code block can be traversed, and then the divisor related operation and the divisor can be found. The other information corresponding to the divisor, whether it is a local variable, whether the divisor contains unary, binary and ternary operators, and the function information contained in the divisor can be detected to judge whether there is a risk of the divisor being 0. If it is judged that the risk of the divisor being 0 is large, the test data can be intercepted. If the risk of the divisor being 0 is not large, the test data can not be intercepted. After the test data is intercepted, the test data and the historical annotation data can be calculated for similarity. If the similarity is greater than the preset similarity, it can be determined that the test data is false positive. At this time, the display report can be generated. If the similarity is less than or equal to the preset similarity, the test data can continue to be intercepted, and the user can repair the test data. If it is considered that the test data is false positive during the repair process, the test data can be marked, and the database where the historical annotation data is located is updated according to the marked test data.

[0132] Through the above steps of the present disclosure, the problem that the sequential access throughput cannot be improved and broken through due to network communication cost (delay and failure) can be effectively reduced. Thus, the sequential access throughput of the entire system is not affected by cross-IDC and network topology, greatly improving the utilization rate of resources by the system. Currently applied in real online systems, the original sequential access throughput is improved by 200% to 300% times.

[0133] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution comply with the relevant legal regulations and do not violate public order and good customs.

[0134] Through the description of the above implementation mode, those skilled in the art can clearly understand that the method according to the above embodiment can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better implementation mode. Based on such understanding, the technical solution of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present disclosure.

[0135] A data processing apparatus is also provided in the present disclosure, which is configured to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.

[0136] Figure 5 is a structural block diagram of a data processing apparatus according to an embodiment of the present disclosure, as shown in Figure 5 The data processing apparatus 500 includes an acquisition module 502 and a test module 504.

[0137] The acquisition module is configured to acquire to-be-tested data. The test module is configured to test the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, where the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether the to-be-tested data is intercepted.

[0138] Optionally, the test module includes a test unit configured to test the to-be-tested data based on the target data in the to-be-tested data and the variable change chain, to obtain a second test result, where the second test result is used to represent whether the target data is a preset constant. The test unit is further configured to, in response to the target data not being the preset constant in the second test result, judge whether the to-be-tested data conforms to a preset rule. The test unit is further configured to, in response to the to-be-tested data not conforming to the preset rule, test the to-be-tested data based on historical labeled data, to obtain the first test result.

[0139] Optionally, the interception unit includes a processing subunit configured to perform feature processing on the historical labeled data and the to-be-tested data, to obtain historical feature information of the historical labeled data and first feature information of the to-be-tested data, where the historical labeled data is used to represent mis-intercepted data. A first comparison subunit is configured to compare the first feature information and the historical feature information, to determine target feature information based on a comparison result, where the comparison result is used to represent a similarity between the first feature information and the historical feature information, and the target feature information is feature information in the first feature information that has a similarity greater than a preset similarity with the historical feature information. A first acquisition subunit is configured to acquire mis-intercepted test data corresponding to the target feature information. A first interception subunit is configured to intercept other test data in the to-be-tested data except the mis-intercepted test data.

[0140] Optionally, the testing unit comprises: a second comparison sub-unit, configured to compare the target data with a preset constant to obtain a comparison result in response to the target data being a constant; and a second intercepting sub-unit, configured to intercept the to-be-tested data in response to the comparison result indicating that the target data is the preset constant.

[0141] Optionally, the testing unit comprises: a second acquisition sub-unit, configured to acquire a variable in the target data in response to the target data containing the variable; and a first testing sub-unit, configured to test the variable based on the variable change chain to obtain a second testing result.

[0142] Optionally, the testing unit comprises: a third acquisition sub-unit, configured to acquire a function in the target data in response to the target data containing the function; a second determination sub-unit, configured to determine a value range of the function based on the variable change chain; and a second testing sub-unit, configured to test the target data based on the value range to obtain a second testing result.

[0143] Optionally, the testing unit comprises: a fourth acquisition sub-unit, configured to acquire a first expression in the target data in response to the target data containing the first expression; a first conversion sub-unit, configured to convert the first expression into a target character by using a preset format; and a second intercepting sub-unit, configured to intercept the to-be-tested data in response to the target character containing a preset constant.

[0144] Optionally, the testing unit comprises: a fifth acquisition sub-unit, configured to acquire a second expression in the target data in response to the target data containing the second expression, wherein a number of operator symbols in the second expression is greater than or equal to a number of operator symbols in the first expression; a second conversion sub-unit, configured to convert a middle-expression in the second expression into a postfix expression; a calculation sub-unit, configured to calculate the postfix expression based on the variable change chain to obtain a target value; and a third intercepting sub-unit, configured to intercept the to-be-tested data in response to the target value being less than or equal to a preset constant.

[0145] It should be noted that the above modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: the above modules are located in the same processor; or the above modules are located in different processors in any combination.

[0146] According to another aspect of the embodiments of the present disclosure, a computer readable storage medium is also provided, which comprises a stored program, wherein the program controls a device where the computer readable storage medium is located to perform any one of the data processing methods in the above embodiments when the program is running.

[0147] According to another aspect of the embodiments of the present disclosure, a processor is further provided, which is used to run a program, wherein the program performs the data processing method of any of the above-mentioned embodiments when running.

[0148] According to another aspect of the embodiments of the present disclosure, a computer program product is further provided, which performs the data processing method of any of the embodiments of the function when executed by a processor.

[0149] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations and do not violate public order and good customs.

[0150] It should be noted that the above-mentioned modules can be realized by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: the above-mentioned modules are located in the same processor; or the above-mentioned modules are located in different processors in any combination.

[0151] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device comprising a memory and at least one processor, the memory storing computer instructions, and the processor being configured to run the computer instructions to perform the steps in any of the above-mentioned method embodiments.

[0152] Optionally, the electronic device can further comprise a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0153] Optionally, in the present disclosure, the processor can be configured to perform the following steps by using a computer program:

[0154] S1, acquiring to-be-tested data.

[0155] S2, testing the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether to intercept the to-be-tested data.

[0156] Optionally, specific examples in the present embodiment can refer to the examples described in the above-mentioned embodiments and optional implementation manners, which will not be described herein again.

[0157] According to the embodiments of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are configured to perform the steps in any of the above-mentioned method embodiments when running.

[0158] Optionally, in the embodiment, the non-volatile storage medium can be configured to store a computer program for executing the following steps:

[0159] S1, obtaining to-be-tested data.

[0160] S2, testing the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in the data, and the first test result is used to indicate whether the to-be-tested data is intercepted.

[0161] Optionally, in the embodiment, the non-transitory computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any suitable combination of the above. More specific examples of a readable storage medium can include one or more electrical connections based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0162] According to the embodiments of the present disclosure, the present disclosure also provides a computer program product. The program code for implementing the audio processing method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, so that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed completely on a machine, partially on a machine, partially on a machine as a separate software package, and partially on a remote machine or server.

[0163] In the above-described embodiments of the present disclosure, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0164] In several embodiments provided by the present disclosure, it should be understood that the disclosed technology can be implemented in other manners. For example, the described unit embodiments can be divided into other ways, for example, the units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be implemented by using some interfaces, and the indirect couplings or communication connections can be implemented in electronic, mechanical, or other forms.

[0165] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, can be located in one place, or can be distributed on multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0166] In addition, each functional unit in the various embodiments of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0167] The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present disclosure, essentially or in part, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The foregoing storage medium includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, magnetic disk or optical disk, and various other media that can store program codes.

[0168] The above only describes the preferred embodiments of the present disclosure, and it should be pointed out that, for those skilled in the art, without departing from the principles of the present disclosure, several improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present disclosure.

Claims

1. A data processing method, wherein, The method comprises the following steps: acquiring to-be-tested data; testing the to-be-tested data based on target data and a variable change chain in the to-be-tested data, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in data, and the first test result is used to indicate whether the to-be-tested data is intercepted; wherein the testing of the to-be-tested data based on the target data and the variable change chain in the to-be-tested data to obtain the first test result comprises: testing the to-be-tested data based on the target data and the variable change chain in the to-be-tested data to obtain a second test result, wherein the second test result is used to indicate whether the target data is a preset constant; in response to the target data not being the preset constant in the second test result, determining whether the to-be-tested data meets a preset rule; in response to the to-be-tested data not meeting the preset rule, testing the to-be-tested data based on historical labeled data to obtain the first test result.

2. The method of claim 1, wherein, The testing of the to-be-tested data based on the historical labeled data to obtain the first test result comprises: performing feature processing on the historical labeled data and the to-be-tested data to obtain historical feature information of the historical labeled data and first feature information of the to-be-tested data, wherein the historical labeled data is used to indicate mis-intercepted data; comparing the first feature information and the historical feature information, and determining target feature information based on a comparison result, wherein the comparison result is used to indicate a similarity between the first feature information and the historical feature information, and the target feature information is feature information in the first feature information that is similar to feature information in the historical feature information with a similarity greater than a preset similarity; acquiring mis-intercepted test data corresponding to the target feature information; intercepting other test data in the to-be-tested data except the mis-intercepted test data.

3. The method of claim 1, wherein, The testing of the to-be-tested data based on the target data and the variable change chain in the to-be-tested data to obtain the second test result comprises: in response to the target data being a constant, comparing the target data and the preset constant to obtain a comparison result; in response to the comparison result being that the target data is the preset constant, intercepting the to-be-tested data.

4. The method of claim 3, wherein, The testing of the to-be-tested data based on the target data and the variable change chain in the to-be-tested data to obtain the second test result comprises: in response to the target data containing a variable, acquiring the variable in the target data; testing the variable based on the variable change chain to obtain the second test result.

5. The method of claim 4, wherein, The testing of the to-be-tested data based on the target data and the variable change chain in the to-be-tested data to obtain the second test result comprises: in response to the target data containing a function, acquiring the function in the target data; determining a value range of the function based on the variable change chain; testing the target data based on the value range to obtain the second test result.

6. The method of claim 5, wherein, Test the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a second test result, including: In response to the target data containing a first expression, obtain the first expression in the target data; Convert the first expression into a target character using a preset format; In response to the target character containing the preset constant, intercept the to-be-tested data.

7. The method of claim 6, wherein, Test the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a second test result, including: In response to the target data containing a second expression, obtain the second expression in the target data, wherein the number of operator symbols in the second expression is greater than or equal to the number of operator symbols in the first expression; Convert the infix expression in the second expression into a postfix expression; Calculate the postfix expression based on the variable change chain, to obtain a target value; In response to the target value being less than or equal to the preset constant, intercept the to-be-tested data.

8. A data processing apparatus, wherein, Including: An acquisition module, configured to acquire to-be-tested data; A test module, configured to test the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a first test result, wherein the variable change chain is used to describe change information of a variable value range in data, and the first test result is used to indicate whether the to-be-tested data is intercepted; The test module further includes: a test unit, configured to test the to-be-tested data based on target data in the to-be-tested data and a variable change chain, to obtain a second test result, wherein the second test result is used to represent whether the target data is a preset constant; a judgment unit, configured to, in response to the target data in the second test result not being the preset constant, judge whether the to-be-tested data meets a preset rule; and the test unit is further configured to, in response to the to-be-tested data not meeting the preset rule, test the to-be-tested data based on historical labeled data, to obtain the first test result.

9. The apparatus of claim 8, wherein, An interception unit, including: A processing subunit, configured to perform feature processing on the historical labeled data and the to-be-tested data, to obtain historical feature information of the historical labeled data and first feature information of the to-be-tested data, wherein the historical labeled data is used to represent mis-intercepted data; A first comparison subunit, configured to compare the first feature information and the historical feature information, to determine target feature information based on a comparison result, wherein the comparison result is used to represent a similarity between the first feature information and the historical feature information, and the target feature information is feature information in the first feature information that has a similarity greater than a preset similarity with the historical feature information; A first acquisition subunit, configured to acquire mis-intercepted test data corresponding to the target feature information; A first interception subunit, configured to intercept other test data in the to-be-tested data except the mis-intercepted test data.

10. The apparatus of claim 8, wherein, A test unit, including: The second comparison subunit is configured to compare the target data and the preset constant to obtain a comparison result in response to the target data being a constant. The second interception subunit is configured to intercept the to-be-tested data in response to the comparison result indicating that the target data is the preset constant.

11. The apparatus of claim 10, wherein, The test unit comprises: The second acquisition subunit is configured to acquire the variable in the target data in response to the target data containing the variable. The first test subunit is configured to test the variable based on the variable change chain to obtain the second test result.

12. The apparatus of claim 11, wherein, The test unit comprises: The third acquisition subunit is configured to acquire the function in the target data in response to the target data containing the function. The second determination subunit is configured to determine the value range of the function based on the variable change chain. The second test subunit is configured to test the target data based on the value range to obtain the second test result.

13. The apparatus of claim 12, wherein, The test unit comprises: The fourth acquisition subunit is configured to acquire the first expression in the target data in response to the target data containing the first expression. The first conversion subunit is configured to convert the first expression into a target character by using a preset format. The second interception subunit is configured to intercept the to-be-tested data in response to the target character containing the preset constant.

14. The apparatus of claim 13, wherein, The test unit comprises: The fifth acquisition subunit is configured to acquire the second expression in the target data in response to the target data containing the second expression, where the number of operator symbols in the second expression is greater than or equal to the number of operator symbols in the first expression. The second conversion subunit is configured to convert the infix expression in the second expression into a postfix expression. The calculation subunit is configured to calculate the postfix expression based on the variable change chain to obtain a target value. The third interception subunit is configured to intercept the to-be-tested data in response to the target value being less than or equal to the preset constant.

15. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

16. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-7.

17. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-7.

17. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Code static auditing device and method

    CN107908405A