Program code verification method, electronic device and computer-readable storage medium

By adding memory identifiers to the logical description information of the program code, target logical description information is generated, which solves the limitation of existing technologies in verifying complex program code, realizes support for pointer aliases, and improves the effectiveness and wide applicability of verification.

WO2026031795A1PCT designated stage Publication Date: 2026-02-12CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/102538
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-09
Filing Date
2025-07-04
Publication Date
2026-02-12

AI Technical Summary

Technical Problem

Existing layered verification methods cannot effectively support program code with complex memory operations, especially program code with pointer aliases, resulting in significant limitations in verification.

Method used

By obtaining the execution results of the program code and its associated code, initial logical description information is generated, and memory identifiers are added to it to form target logical description information for verification. It supports the abstraction and summarization of any program code, including pointer aliases.

Benefits of technology

It enables effective verification of any program code, reduces verification limitations, and eliminates the need to redesign or extend the code abstraction and summary analysis engine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025102538_12022026_PF_FP_ABST
    Figure CN2025102538_12022026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present disclosure are a program code verification method, an electronic device and a computer-readable storage medium. The method comprises: acquiring program codes to be verified and associated program codes of the program codes, the program codes being used for calling an execution result of the associated program codes during execution; analyzing the associated program codes to obtain first initial logic description information, the first initial logic description information being information used for describing execution logic of the associated program codes, and the associated program codes being executed on the basis of the execution logic so as to obtain an execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information; and, on the basis of the first target logic description information, verifying the program codes to obtain a verification result, the verification result being used for representing the correctness of the program codes. The present disclosure solves the technical problem of great limitations on verification of program codes.
Need to check novelty before this filing date? Find Prior Art

Description

Verification method of program code, electronic device and computer readable storage medium

[0001] Cross-reference to related applications

[0002] The present disclosure claims priority to the Chinese patent publication with the publication number 2024110992562 and the publication name "Verification method of program code, electronic device and computer readable storage medium" filed on August 9, 2024 with the China Patent Office, the entire content of which is incorporated herein by reference. TECHNICAL FIELD

[0003] The present disclosure relates to the field of software engineering, in particular to the technical field of program abstraction, program verification and the like, specifically to a verification method of program code, an electronic device and a computer readable storage medium. BACKGROUND

[0004] At present, with the increasing perfection and complexity of software systems, in order to ensure the correctness of the software systems, a layered verification method with program automatic summarization capability is often used to perform formal verification on program code for implementing the software systems.

[0005] However, the above-mentioned verification method based on layering can only support program code with relatively simple memory operations, and cannot support program code with more complex memory operations, for example, cannot support program code with pointer aliasing, thereby resulting in the technical problem of great limitation in verifying program code.

[0006] At present, there is no effective solution to the above-mentioned technical problem of great limitation in verifying program code. SUMMARY

[0007] The embodiments of the present disclosure provide a verification method of program code, an electronic device and a computer readable storage medium to at least solve the technical problem of great limitation in verifying program code.

[0008] According to an aspect of embodiments of the present disclosure, a program code verification method is provided. The method can include obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; and verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code.

[0009] According to another aspect of embodiments of the present disclosure, a program code verification method is provided. The method can include obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process, and the associated program code includes a target pointer used to index a target memory object; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored, and the first initial logic description information does not include the target pointer; and verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code.

[0010] According to still another aspect of embodiments of the present disclosure, a domain name system program code verification method is provided. The method can include obtaining program code to be verified in a domain name system and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code; and returning the verification result to the domain name system.

[0011] According to a further aspect of the embodiments of the present disclosure, a method for analyzing program code is provided. The method can include: obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; and analyzing the program code based on the first target logic description information to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code.

[0012] According to a further aspect of the embodiments of the present disclosure, a method for verifying program code is provided. The method can include: obtaining program code to be verified and associated program code of the program code by calling a first interface, wherein the program code is configured to call an execution result of the associated program code in an execution process, and the first interface includes a first parameter, and a parameter value of the first parameter is the program code and the associated program code; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code; and outputting the verification result by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter is the verification result.

[0013] According to a further aspect of the embodiments of the present disclosure, a verification system of program code is provided. The system can include: a client configured to upload program code to be verified, and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; a server configured to analyze the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, the associated program code is used to execute according to the execution logic to obtain the execution result; add a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verify the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code; and deliver the verification result to the client.

[0014] According to another aspect of the embodiments of the present disclosure, an electronic device is also provided, which can include a memory and a processor: the memory stores an executable program; the processor is configured to run the executable program, and when the executable program is run by the processor, any of the above methods is implemented.

[0015] According to another aspect of the embodiments of the present disclosure, a computer readable storage medium is also provided, which includes a stored executable program, wherein when the executable program is run, the device where the computer readable storage medium is located is controlled to perform the method in various embodiments of the present disclosure.

[0016] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, which includes computer instructions, and when the computer instructions are executed by a processor, the method in various embodiments of the present disclosure is implemented.

[0017] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, which includes a non-volatile computer readable storage medium, the non-volatile computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in various embodiments of the present disclosure is implemented.

[0018] According to another aspect of the embodiments of the present disclosure, a computer program is also provided, and when the computer program is executed by a processor, the method in various embodiments of the present disclosure is implemented.

[0019] In the embodiments of the present disclosure, in the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained. The first initial logical description information can be obtained by analyzing the obtained associated program code. The first memory identifier can be added to the first initial logical description information obtained by analysis, and the first target logical description information can be obtained. According to the first target logical description information obtained, the program code is verified, and the verification result can be obtained, that is, the correctness of the program code can be obtained. Since in the process of verifying the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, but also the program code is verified according to the first target logical description information after adding the first memory identifier, and thus the correctness of the program code is obtained, so that the purpose of verifying the program code according to the first target logical description information after adding the memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support for any program code (including the program code of pointer alias), and the analysis engine of the code abstract summary does not need to be redesigned and expanded, the technical effect of reducing the limitation of verifying the program code is realized, and thus the technical problem of large limitation of verifying the program code is solved.

[0020] It is easy to note that the general description above and the detailed description below are only for illustrating and explaining the present disclosure, and do not constitute the limitation of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0021] The drawings described herein are used to provide further understanding of the present disclosure, and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure, and do not constitute the improper limitation of the present disclosure. In the drawings:

[0022] FIG. 1 is a schematic diagram of an application scenario of a program code verification method according to an embodiment of the present disclosure;

[0023] FIG. 2 is a flowchart of a program code verification method according to an embodiment of the present disclosure;

[0024] FIG. 3 is a flowchart of another program code verification method according to an embodiment of the present disclosure;

[0025] FIG. 4 is a flowchart of a program code verification method of a domain name system according to an embodiment of the present disclosure;

[0026] FIG. 5 is a flowchart of a program code analysis method according to an embodiment of the present disclosure;

[0027] FIG. 6 is a flowchart of a program code verification method according to an embodiment of the present disclosure;

[0028] FIG. 7 is a schematic diagram of a program code verification system according to an embodiment of the present disclosure;

[0029] FIG. 8(a) is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a program code verification method according to an embodiment of the present disclosure;

[0030] FIG. 8(b) is a structure block diagram of a computing environment for implementing a live room scene generation method according to an embodiment of the present disclosure;

[0031] FIG. 9(a) is a schematic diagram of a program code verification effect according to an embodiment of the present disclosure;

[0032] FIG. 9(b) is a schematic diagram of a program code branch according to an embodiment of the present disclosure;

[0033] FIG. 9(c) is a schematic diagram of another program code branch according to an embodiment of the present disclosure;

[0034] FIG. 9(d) is a schematic diagram of yet another program code branch according to a related art;

[0035] FIG. 9(e) is a schematic diagram of a code behavior description according to an embodiment of the present disclosure;

[0036] FIG. 9(f) is a schematic diagram of another code behavior description according to an embodiment of the present disclosure;

[0037] FIG. 10 is a schematic diagram of a program code verification apparatus according to an embodiment of the present disclosure;

[0038] FIG. 11 is a schematic diagram of another program code verification apparatus according to an embodiment of the present disclosure;

[0039] FIG. 12 is a schematic diagram of a domain name system program code verification apparatus according to an embodiment of the present disclosure;

[0040] FIG. 13 is a schematic diagram of a program code analysis apparatus according to an embodiment of the present disclosure;

[0041] FIG. 14 is a schematic diagram of a program code verification apparatus according to an embodiment of the present disclosure;

[0042] FIG. 15 is a block diagram of an electronic device for a program code verification method according to an embodiment of the present disclosure;

[0043] FIG. 16 is a structure block diagram of a computer terminal according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0044] In order to make the person skilled in the art better understand the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, not all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor should fall within the scope of protection of the present disclosure.

[0045] It should be noted that the terms "first", "second" and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0046] First, some nouns or terms that appear in the description of the embodiments of the present disclosure are applicable to the following explanations:

[0047] Symbolic execution is a code analysis technique that can be used to systematically traverse all possible execution paths in the code.

[0048] Abstract summary of program code is a code analysis technique that can use symbolic execution to traverse the behavior of a piece of code and summarize the computational logic of the code under different input conditions into an abstract behavior description. Abstract summary of program code can be used in correctness proof of software, and is also a key technology for proving correctness of large-scale software.

[0049] Correctness of software can be used to describe whether the behavior of program code completely conforms to the behavior description defined by the designer in advance. The higher the correctness of the software, the more the behavior of the program code conforms to the behavior description defined by the designer in advance. This is only an example and is not limited.

[0050] Pointer aliasing is a code pattern. For example, in the case where there are multiple different pointer variables in the program code, the memory objects pointed to by the multiple different pointer variables can be the same. This is only an example and is not limited.

[0051] According to the embodiments of the present disclosure, a program code verification method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set 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 here.

[0052] The program code verification method provided by the embodiments of the present disclosure can be applied to a program code verification tool in the application scenario as shown in FIG. 1, but is not limited thereto. In the application scenario as shown in FIG. 1, the program code verification method is deployed in a server 10, which can be a cloud. The server 10 can be connected to one or more client devices 20 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks. The client devices 20 here can include but are not limited to: smartphones, tablet computers, notebook computers, palm computers, personal computers, smart home devices, vehicle-mounted devices, etc., and the client devices 20 collectively constitute a client opposite the server 10. On the graphical user interface of the client device 20, an operation interface for displaying the verification result can be deployed, which can be the operation interface of the development platform. The client device 20 can interact with the user through the graphical user interface to realize the calling of the program code verification method, and thus realize the program code verification method provided by the embodiments of the present disclosure.

[0053] In the embodiments of the present disclosure, the system composed of the client device and the server can execute the following steps: in the process of verifying the program code, the user can use a mobile phone, a desktop computer, a notebook computer, or other client devices to communicate with the server through a network. After the server receives the verification instruction sent by the user through the client device, the server can execute step S102 to obtain the program code to be verified and the associated program code of the program code, execute step S104 to analyze the associated program code to obtain the first initial logical description information, execute step S106 to add the first memory identifier to the first initial logical description information to obtain the first target logical description information, and execute step S108 to verify the program code based on the first target logical description information to obtain the verification result. In the above process, after the server receives the verification instruction sent by the user through the client device, the server can send the verification result to the client device. It should be noted that in the case that the running resources of the client device can meet the deployment and running conditions of the program code verification method, the embodiments of the present disclosure can be performed in the client device.

[0054] In the operating environment, the disclosure provides a program code verification method as shown in FIG. 2. FIG. 2 is a flowchart of a program code verification method according to an embodiment of the disclosure. As shown in FIG. 2, the method can include the following steps:

[0055] In step S202, the program code to be verified and the associated program code of the program code are obtained.

[0056] In the technical solution provided in step S202 of the disclosure, the program code can be used to call the execution result of the associated program code during execution.

[0057] In this embodiment, the program code can be the code of an upper layer function module. The associated program code can be the code of a lower layer function module of the code of the upper layer function module. The code of the upper layer function module can be used to call the execution result of the code of the lower layer function module during execution. For example, the execution result can be displayed in at least one of the following forms: numerical value, array, matrix, etc. This is only an example and is not limited.

[0058] In this embodiment, the program code to be verified and the associated program code of the program code are obtained. Optionally, the plurality of program codes are classified to obtain a classification result, wherein the classification result can be used to indicate whether the program code has completed verification. For example, the classification result can be that the program code has completed verification, or the classification result can be that the program code has not completed verification. This is only an example and is not limited. According to the obtained classification result, the program code to be verified is selected. Based on the program code to be verified, the function module called by the program code to be verified is detected, and the program code corresponding to the detected function module called by the program code to be verified is determined as the associated program code of the program code.

[0059] Optionally, according to the obtained classification result, the program code to be verified is selected. For example, if the obtained classification result is that the program code has completed verification, the program code to be verified is selected from the program codes other than the program code that has completed verification; if the obtained classification result is that the program code has not completed verification, the program code to be verified is selected from the plurality of program codes that have not completed verification.

[0060] In step S204, the associated program code is analyzed to obtain first initial logic description information.

[0061] In the technical solution provided in step S204 of the present disclosure, the first initial logic description information can be information used to describe the execution logic of the associated program code. The associated program code can be used to execute according to the execution logic to obtain an execution result. For example, the first initial logic description information can include the stored data in the associated program code, the stored data in the associated program code can include the function parameters and / or return values of the associated program code, the function parameters and / or return values of the associated program code can be used to adjust the execution logic of the associated program code, and the return value of the associated program code can be used to provide information about the execution logic to the program code that calls the associated program code. This is only an example and is not limited in a specific manner.

[0062] In this embodiment, the analysis operation on the associated program code can be an operation of abstractly summarizing the behaviors implemented by the associated program code. The first initial logic description information can be information used to describe the execution logic of the code of the lower-level function module. For example, the first initial logic description information can include the stored data of the code of the lower-level function module, the stored data of the code of the lower-level function module can include the function parameters and / or return values of the code of the lower-level function module, the function parameters and / or return values of the code of the lower-level function module can be used to adjust the execution logic of the code of the lower-level function module, and the return value of the code of the lower-level function module can be used to provide information about the execution logic to the program code that calls the code of the lower-level function module. This is only an example and is not limited in a specific manner.

[0063] After obtaining the program code to be verified and the associated program code of the program code, this embodiment analyzes the associated program code to obtain the first initial logic description information. Alternatively, after obtaining the program code to be verified and the associated program code of the program code, the associated program code obtained is abstractly summarized to obtain the first initial logic description information. For example, the associated program code is traversed by symbolic execution to obtain the behaviors of the associated program code, and the calculation logic of the obtained associated program code under different input conditions is summarized as an abstract behavior description to obtain the first initial logic description information.

[0064] It should be noted that the method of obtaining the first initial logic description information is only an example and is not limited in a specific manner herein. As long as the process and method can analyze the associated program code to obtain the first initial logic description information, they are within the protection scope of the embodiments of the present disclosure.

[0065] In step S206, a first memory identifier is added to the first initial logic description information to obtain first target logic description information.

[0066] In the technical solution provided in the step S206 of the present disclosure, the first memory identifier can be used to represent a target memory object to which the first initial logical description information is stored.

[0067] In this embodiment, the first memory identifier can be a memory mark introduced to the parameters and / or return values of each function in the first initial logical description information. The first memory identifier can be used to represent a memory object in which the parameters and / or return values of each function in the first initial logical description information are stored. The introduced memory mark can be represented by a ref mark and a mark other than the ref mark. The ref mark can be applied to program code in which a pointer alias exists. The mark other than the ref mark can be applied to program code in which a pointer alias does not exist. This is only an example and is not limited in particular.

[0068] After the first initial logical description information is obtained by analyzing the associated program code, the first memory identifier is added to the first initial logical description information, and the first target logical description information can be obtained. Alternatively, based on the first initial logical description information, a memory mark is introduced to the parameters and / or return values of each function in the first initial logical description information, and the introduced memory mark is added to the first initial logical description information, so as to obtain the first target logical description information.

[0069] For example, if the associated program code includes a function f1 and a function f2, a memory mark is introduced to the parameters and / or return values of the function f1 and the function f2 in the first initial logical description information, and the introduced memory mark is added to the first initial logical description information, so as to obtain the first target logical description information. This is only an example and is not limited in particular.

[0070] In the step S208, the program code is verified based on the first target logical description information, and a verification result is obtained.

[0071] In the technical solution provided in the step S208 of the present disclosure, the verification result can be used to represent the correctness of the program code.

[0072] In this embodiment, the verification result can be that the program code is correct. If the program code is correct, it means that the behavior of the program code conforms to the behavior description defined by the designer in advance. Alternatively, the verification result can also be that the program code is incorrect. If the program code is incorrect, it means that the behavior of the program code does not conform to the behavior description defined by the designer in advance. This is only an example and is not limited in particular.

[0073] The embodiment adds the first memory identifier to the first initial logical description information to obtain the first target logical description information, and then verifies the program code based on the first target logical description information to obtain a verification result. Optionally, the associated program code of the program code is verified based on the first target logical description information. The program code is verified based on the fact that the associated program code of the program code is verified to be correct, and the verification result, i.e., the correctness of the program code, is obtained.

[0074] In the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained through the steps S202 to S208 of the present disclosure. The first initial logical description information can be obtained by analyzing the obtained associated program code. The first target logical description information can be obtained by adding the first memory identifier to the obtained first initial logical description information. The verification result, i.e., the correctness of the program code, can be obtained by verifying the program code based on the obtained first target logical description information. Since the first memory identifier is added to the obtained first initial logical description information to obtain the first target logical description information, and the program code is verified based on the first target logical description information, the correctness of the program code is obtained. Therefore, the program code can be verified based on the first target logical description information with the added memory identifier. The first memory identifier added to the first initial logical description information can support the abstract summary of any program code, including the program code with pointer aliasing, and the analysis engine for code abstract summary does not need to be redesigned and expanded. Therefore, the limitation of verifying the program code is reduced, and the technical problem of the limitation of verifying the program code is solved.

[0075] The above method of the embodiment will be further described below.

[0076] As an optional implementation, in step S206, the first memory identifier is added to the first initial logical description information to obtain the first target logical description information, including: determining the stored data in the associated program code in the first initial logical description information; and adding the first memory identifier to the stored data in the associated program code to obtain the first target logical description information.

[0077] In this embodiment, the storage data in the associated program code can include function parameters and / or return values. For example, if there is a function f1 in the associated program code, the storage data in the associated program code can include the parameters and / or return values of the function f1; if there is a function f2 in the associated program code, the storage data in the associated program code can include the parameters and / or return values of the function f2, which is only for illustration and is not limited.

[0078] In this embodiment, after the analysis of the associated program code, the first initial logical description information is obtained, and the storage data in the associated program code is determined in the first initial logical description information. Alternatively, based on the first initial logical description information, the storage data in the associated program code can be determined in the obtained first initial logical description information, for example, the function parameters and / or return values in the associated program code can be determined.

[0079] In this embodiment, after the storage data in the associated program code is determined, the first memory identifier is added to the storage data in the associated program code, and the first target logical description information is obtained. Alternatively, based on the determination of the storage data in the associated program code, the memory mark is introduced to the parameters and / or return values of each function in the determined storage data in the associated program code, and the memory mark is added to the storage data in the associated program code, so as to obtain the first target logical description information, thereby achieving the purpose of introducing the memory mark in the verification process of the program code. Since the first memory identifier is added to the first initial logical description information obtained by analysis in the verification process of the program code, the function of supporting the abstract summary of any program code without the need to redesign and expand the analysis engine of the code abstract summary is achieved.

[0080] Alternatively, based on the first initial logical description information, the data filtering is performed on the obtained first initial logical description information, and the storage data in the associated program code is obtained. The first memory identifier is introduced to the parameters and / or return values of each function in the obtained storage data in the associated program code, and the first memory identifier is added to the storage data in the associated program code, so as to obtain the first target logical description information, which is only for illustration and is not limited.

[0081] As an optional implementation, the first memory identifier is added to the storage data in the associated program code to obtain the first target logical description information, including: determining a target memory object to which the storage data is stored; determining a target pointer corresponding to the target memory object; based on the target pointer, adding the first memory identifier to the storage data in the associated program code to obtain the first target logical description information.

[0082] In this embodiment, the target pointer can be used to index the target memory object.

[0083] In this embodiment, in the first initial logical description information, after determining the stored data in the associated program code, the target memory object to which the stored data is stored is determined, and the target pointer corresponding to the target memory object is determined. Optionally, on the basis of determining the stored data in the associated program code, the memory object is allocated for the stored data, the allocated memory object is determined as the target memory object to which the stored data is stored, and the stored data stored in the target memory object is determined as the stored data stored by the target pointer corresponding to the target memory object.

[0084] In this embodiment, after the target pointer is determined, the first memory identifier is added to the stored data in the associated program code based on the target pointer, and the first target logical description information is obtained. Optionally, on the basis of determining the target pointer, the memory mark is introduced into the parameters and / or return values of each function in the determined stored data in the associated program code according to the target pointer corresponding to the target memory object, and the memory mark is added to the stored data in the associated program code, so as to obtain the first target logical description information, thereby achieving the purpose of introducing the memory mark for the program code including the pointer alias in the process of verifying the program code. Since the first memory identifier can be added to the stored data in the associated program code according to the target pointer in the embodiment of the present disclosure, the function of supporting the abstract summary for the program code including the pointer alias is achieved.

[0085] It should be noted that the method of obtaining the first target logical description information is only for example and is not specifically limited herein. As long as the process and method of obtaining the first target logical description information by adding the first memory identifier are within the protection scope of the embodiment of the present disclosure.

[0086] As an optional implementation, the first memory identifier is added to the stored data in the associated program code based on the target pointer, and the first target logical description information is obtained, including: generating the first memory identifier based on the target pointer; adding the generated first memory identifier to the stored data in the associated program code, and obtaining the first target logical description information.

[0087] In this embodiment, after the target pointer corresponding to the target memory object is determined, the first memory identifier is generated based on the target pointer. Optionally, after the target pointer corresponding to the target memory object is determined, a memory object is allocated for storing data, and the allocated memory object is determined as the target memory object to which the storing data is stored. The storing data stored in the target memory object is determined as the storing data stored in the target pointer corresponding to the target memory object, and the first memory identifier can be generated according to the rule of storing the same storing data.

[0088] In this embodiment, after the first memory identifier is generated, the generated first memory identifier is added to the storing data in the associated program code to obtain the first target logical description information. Optionally, after the first memory identifier is generated, the first memory identifier is introduced into the parameter and / or return value of each function in the determined storing data in the associated program code, and the first memory identifier is added to the storing data in the associated program code, so as to obtain the first target logical description information, thereby achieving the purpose of introducing the memory mark for the program code including the pointer alias in the process of verifying the program code. Since the first memory identifier can be added to the storing data in the associated program code according to the target pointer, the function of supporting the abstract summary for the program code including the pointer alias is achieved.

[0089] As an optional implementation, the method further includes: determining a pointer identifier corresponding to the target pointer; and adding the first memory identifier and the pointer identifier to the storing data in the associated program code based on the target pointer to obtain the first target logical description information.

[0090] In this embodiment, the pointer identifier can be used to indicate that the target pointer is prohibited from being used. For example, the pointer identifier can be represented by inhib, which is only an example and is not limited in particular.

[0091] In this embodiment, the pointer identifier corresponding to the target pointer is determined. Optionally, after the target pointer is determined, the corresponding pointer identifier is generated for the determined target pointer, so as to index the target memory object by using the target pointer, and prohibit the target pointer from being accessed in the subsequent process, thereby achieving the purpose of limiting only one pointer to perform read and write operations when multiple pointers index the same memory object, so as to ensure the correctness of the first target logical description information calculated subsequently.

[0092] In this embodiment, after determining the pointer identifier corresponding to the target pointer, the first memory identifier and the pointer identifier are added to the storage data in the associated program code based on the target pointer, and the first target logical description information can be obtained. Optionally, the first memory identifier is generated based on the target pointer in this embodiment. After determining the target pointer corresponding to the target memory object, the memory object is allocated for the storage data, and the allocated memory object is determined as the target memory object to which the storage data is stored. The storage data stored in the target memory object is determined as the storage data stored by the target pointer corresponding to the target memory object, and the first memory identifier can be generated according to the rule of storing the same storage data. After determining the pointer identifier, the first memory identifier and the pointer identifier are introduced to the parameter and / or return value of each function in the determined storage data in the associated program code, and the first memory identifier and the pointer identifier are added to the storage data in the associated program code, so that the first target logical description information is obtained, thereby achieving the purpose of introducing the memory identifier and the pointer identifier to the storage data in the associated program code. Since the pointer identifier is introduced, the target pointer can be prohibited from being accessed subsequently, thereby avoiding errors caused by incorrect handling of pointer aliasing and behavior analysis of functions.

[0093] As an optional implementation, the method further includes: in the process of analyzing the program code based on the first target logical description information, if the storage data stored in the target memory object is updated, the updated storage data is associated to the target pointer.

[0094] In this embodiment, in the process of analyzing the program code based on the first target logical description information, if the storage data stored in the target memory object is updated, the updated storage data is associated to the target pointer. Optionally, the updated storage data is written back to the target pointer indexing the target memory object based on the updated storage data stored in the target memory object. For example, if the value stored in the memory b is updated from Point{x:x0,y:y0} to Point{x:0,y:y0}, the updated storage value Point{x:0,y:y0} is written back to the pointer c indexing the memory b, which is only used for illustration and is not limited in a specific manner.

[0095] As an optional implementation, the method further includes: in the case that the return value in the program code is updated and the memory object to which the return value in the program code is stored is the same as the target memory object, the storage data stored in the target memory object is updated based on the return value in the program code.

[0096] In this embodiment, the return value in the program code is updated, and the memory object to which the return value in the program code is stored is the same as the target memory object. Based on the return value in the program code being updated, the stored data stored in the target memory object is updated. Alternatively, based on the return value in the program code being updated, the relationship between the memory object to which the return value in the program code is stored and the target memory object is determined. If it is determined that the memory object to which the return value in the program code is stored is the same as the target memory object, the stored data stored in the target memory object is updated according to the return value in the program code. For example, based on the return value in the program code being updated, the relationship between the memory (p) to which the return value in the program code is stored and the target memory (p=b) is determined. If it is determined that the memory (p) to which the return value in the program code is stored is the same as the target memory (p=b), the stored data stored in the target memory (p=b) is updated according to the return value in the program code. This is only an example and is not limited.

[0097] As an optional implementation, the target pointer is included in the associated program code, and the target pointer is not included in the initial logical description information of the first lower function module.

[0098] In this embodiment, the code of the lower function module can include the target pointer, and the initial logical description information of the code of the lower function module can not include the target pointer. For example, the code of the lower function module can include the pointer alias, and the initial logical description information of the code of the lower function module can not include the pointer alias. This is only an example and is not limited, so as to achieve the purpose of introducing the memory mark for the program code including the pointer alias in the process of verifying the program code. Since the memory mark can be added to the stored data in the associated program code according to the target pointer, the effect of supporting the abstract summary of the program code including the pointer alias is achieved.

[0099] As an optional implementation, in step S208, the program code is verified based on the first target logical description information to obtain a verification result, including: analyzing the program code based on the first target logical description information to obtain second initial logical description information; adding a second memory mark to the second initial logical description information to obtain second target logical description information; and verifying the program code based on the second target logical description information to obtain the verification result.

[0100] In this embodiment, the second initial logic description information can be information used to describe the execution logic of the program code. The stored data in the program code can include function parameters and / or return values of the program code, which can be used to adjust the execution logic of the program code, and the return value of the program code can be used to provide information about the execution logic to the program code calling the program code. For example, the second initial logic description information can be information used to describe the execution logic of the code of the upper function module, the stored data in the code of the upper function module can include function parameters and / or return values of the code of the upper function module, which can be used to adjust the execution logic of the code of the upper function module, and the return value of the code of the upper function module can be used to provide information about the execution logic to the program code calling the code of the upper function module. This is only an example and is not limited in this way.

[0101] In this embodiment, the second memory identifier can be used to represent the memory object to which the second initial logic description information is stored. For example, the second memory identifier can be a memory tag introduced to the parameters and / or return values of each function in the second initial logic description information. This is only an example and is not limited in this way.

[0102] In this embodiment, after the first memory identifier is added to the first initial logic description information to obtain the first target logic description information, the program code is analyzed based on the first target logic description information to obtain the second initial logic description information. Alternatively, based on the first target logic description information, the upper program code associated with the program code can be abstracted and summarized to obtain the second initial logic description information. For example, the upper program code can be symbolically executed to obtain the behavior of the upper program code, and the calculation logic of the obtained upper program code under different input conditions can be summarized as an abstract behavior description to obtain the second initial logic description information of the upper program code.

[0103] In this embodiment, after the second initial logic description information is obtained, the second memory identifier is added to the second initial logic description information to obtain the second target logic description information. Alternatively, based on the second initial logic description information, a memory tag can be introduced to the parameters and / or return values of each function in the second initial logic description information, and the memory tag can be added to the second initial logic description information to obtain the second target logic description information.

[0104] For example, if there are function f1, function f2 and function f3 in the program code, the memory mark is introduced to the parameters and / or return values of function f1, function f2 and function f3 in the second initial logic description information, and the introduced memory mark is added to the second initial logic description information, so that the second target logic description information is obtained, which is only for illustration and does not have specific limitation.

[0105] In this embodiment, after the second target logic description information is obtained, the program code is verified by using the second target logic description information, and the verification result is obtained. Alternatively, this embodiment can judge the relationship between the obtained second target logic description information and the standard logic description information of the program code on the basis of the obtained second target logic description information, and can verify the program code to obtain the verification result. If it is judged that the obtained second target logic description information satisfies the standard logic description information of the program code, the verification result obtained by verifying the program code is that the program code is correct; if it is judged that the obtained second target logic description information does not satisfy the standard logic description information of the program code, the verification result obtained by verifying the program code is that the program code is incorrect, so that the purpose that the program code can be verified according to the second target logic description information with the added memory mark is achieved. Since the second memory mark is added to the analyzed second initial logic description information in the verification process of the program code, the program code including the pointer alias can be verified.

[0106] As an optional implementation, adding the second memory mark to the second initial logic description information to obtain the second target logic description information comprises: determining the storage data in the program code in the second initial logic description information; adding the second memory mark to the storage data in the program code to obtain the second target logic description information.

[0107] In this embodiment, the storage data in the program code can include function parameters and / or return values. For example, if there is function f1 in the program code, the storage data in the program code can include the parameters and / or return values of function f1; if there is function f2 in the program code, the storage data in the program code can include the parameters and / or return values of function f2, which is only for illustration and does not have specific limitation.

[0108] In this embodiment, after the program code is analyzed on the basis of the first target logic description information to obtain the second initial logic description information, the storage data in the program code is determined in the second initial logic description information. Alternatively, this embodiment can determine the storage data in the program code in the obtained second initial logic description information on the basis of the obtained second initial logic description information, for example, the function parameters and / or return values in the program code can be determined.

[0109] In this embodiment, after the storage data in the program code is determined, a second memory identifier is added to the storage data in the program code to obtain the second target logical description information. Optionally, based on the determination of the storage data in the program code, a memory mark is introduced to the parameters and / or return values of each function in the determined storage data in the program code, and the memory mark is added to the storage data in the program code, so as to obtain the second target logical description information, thereby achieving the purpose of introducing the memory mark to the storage data in the program code in the process of verifying the program code. Since the memory mark is introduced to the storage data in the program code, the function of supporting the abstract summary of the program code including the pointer aliasing is achieved.

[0110] As an optional implementation, the program code is verified by using the second target logical description information to obtain a verification result, including: if the second target logical description information meets the standard logical description information of the program code, it is determined that the verification result is that the program code is correct; and if the second target logical description information does not meet the standard logical description information, it is determined that the verification result is that the program code is incorrect.

[0111] In this embodiment, based on the obtained second target logical description information, the relationship between the obtained second target logical description information and the standard logical description information of the program code is judged, the program code is verified, and a verification result is obtained. If it is judged that the obtained second target logical description information meets the standard logical description information of the program code, the verification result obtained by verifying the program code is that the program code is correct; and if it is judged that the obtained second target logical description information does not meet the standard logical description information of the program code, the verification result obtained by verifying the program code is that the program code is incorrect, thereby achieving the purpose of verifying the program code including the pointer aliasing. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support of any program code (including the program code including the pointer aliasing), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code.

[0112] The disclosure also provides a verification method of program code. FIG. 3 is a flowchart of another verification method of program code according to an embodiment of the disclosure. As shown in FIG. 3, the method can include the following steps:

[0113] In step S302, the program code to be verified and the associated program code of the program code are obtained.

[0114] In the technical solution provided in the step S302 of the present disclosure, the program code is used to call the execution result of the associated program code in the execution process, and the associated program code can include a target pointer used to index a target memory object. For example, the code of the lower-level function module can include a pointer c used to index the target memory, which is only used for illustration and is not limited in a specific manner.

[0115] The embodiment obtains the program code to be verified and the associated program code of the program code. Optionally, the plurality of program codes are classified to obtain a classification result, where the classification result can be used to indicate whether the program code is verified, for example, the classification result can be that the program code is verified or the program code is not verified, which is only used for illustration and is not limited in a specific manner. According to the obtained classification result, the program code to be verified is selected. Based on the selected program code to be verified, the function module called by the program code to be verified is detected, and the program code corresponding to the detected function module called by the program code to be verified is determined as the associated program code of the program code.

[0116] Optionally, according to the obtained classification result, the program code to be verified is selected. For example, if the obtained classification result is that the program code is verified, the program code to be verified is selected from the program codes other than the program code that has been verified among the plurality of program codes; if the obtained classification result is that the program code is not verified, the program code to be verified is selected from the plurality of program codes that have not been verified.

[0117] In the step S304, the associated program code is analyzed to obtain first initial logic description information.

[0118] In the technical solution provided in the step S304 of the present disclosure, the analysis operation performed on the associated program code can be an operation of abstractly summarizing the behaviors implemented by the associated program code. The first initial logic description information can be information used to describe the execution logic of the code of the lower-level function module.

[0119] After obtaining the program code to be verified and the associated program code of the program code, the embodiment analyzes the associated program code to obtain first initial logic description information. Optionally, based on the obtained program code to be verified and the associated program code of the program code, the obtained associated program code is abstractly summarized to obtain the first initial logic description information. For example, the associated program code is symbolically executed and traversed to obtain behaviors of the associated program code, and the calculation logic of the obtained associated program code under different input conditions is summarized as an abstract behavior description to obtain the first initial logic description information.

[0120] It should be noted that the above method of obtaining the first initial logical description information is only for illustration, and is not limited specifically herein. As long as the process and method of analyzing the associated program code to obtain the first initial logical description information are within the protection scope of the embodiments of the present disclosure.

[0121] In step S306, a first memory identifier is added to the first initial logical description information to obtain first target logical description information.

[0122] In the technical solution provided by the above step S306 of the present disclosure, the first initial logical description information can not include a target pointer, and the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored. For example, the initial logical description information of the code of the lower function module can not include a pointer alias, which is only for illustration and is not limited specifically herein.

[0123] After analyzing the associated program code to obtain the first initial logical description information, the first memory identifier is added to the first initial logical description information to obtain the first target logical description information. Alternatively, on the basis of obtaining the first initial logical description information, a memory mark is introduced to the parameters and / or return values of each function in the first initial logical description information, and the memory mark is added to the first initial logical description information, thereby obtaining the first target logical description information.

[0124] In step S308, the program code is verified based on the first target logical description information to obtain a verification result.

[0125] In the technical solution provided by the above step S308 of the present disclosure, after the first memory identifier is added to the first initial logical description information to obtain the first target logical description information, the program code is verified based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code. Alternatively, on the basis of obtaining the first target logical description information, the associated program code of the program code is verified. On the basis of verifying that the associated program code of the program code is correct, the program code is verified to obtain the verification result, that is, the correctness or incorrectness of the program code can be obtained.

[0126] By the above steps S302 to S308 of the present disclosure, in the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained. By analyzing the obtained associated program code, the first initial logical description information can be obtained. By adding the first memory identifier to the first initial logical description information obtained by analysis, the first target logical description information can be obtained. According to the obtained first target logical description information, the program code is verified, and the verification result can be obtained, that is, the correctness of the program code can be obtained. Since in the process of verifying the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, but also the program code is verified according to the first target logical description information after adding the first memory identifier, thereby obtaining the correctness of the program code, so that the purpose of verifying the program code according to the first target logical description information with the added memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support for any program code (including the program code with pointer aliasing), and there is no need to redesign and expand the analysis engine of the code abstract summary, the technical effect of reducing the limitation of verifying the program code is realized, and the technical problem of large limitation of verifying the program code is solved.

[0127] The present disclosure also provides a program code verification method of a domain name system. FIG. 4 is a flowchart of a program code verification method of a domain name system according to an embodiment of the present disclosure. As shown in FIG. 4, the method can include the following steps:

[0128] In step S402, the program code to be verified in the domain name system and the associated program code of the program code are obtained.

[0129] In the technical solution provided in the above step S402 of the present disclosure, the program code can be the code of an upper function module in the domain name system. The domain name system can be used to represent a distributed naming system for converting domain names into Internet Protocol (IP) addresses, and the associated program code can be the code of a lower function module of the code of the upper function module in the domain name system. The code of the upper function module can be used to call the execution result of the code of the lower function module in the execution process, for example, the domain name system can also be referred to as Domain Name System, and is abbreviated as DNS system. The execution result can be displayed in at least one of the following forms: numerical value, array, matrix, etc. This is only an example and is not limited.

[0130] The embodiment obtains the program code to be verified in the domain name system and the associated program code of the program code. Optionally, the plurality of program codes in the domain name system are classified to obtain a classification result, where the classification result can be used to indicate whether the program code is verified, for example, the classification result can be that the program code is verified or the program code is not verified, which are only examples and are not limited specifically. According to the obtained classification result, the program code to be verified in the domain name system is selected. On the basis of the program code to be verified in the domain name system, the function module called by the program code to be verified in the domain name system is detected, and the program code corresponding to the detected function module called by the program code to be verified in the domain name system is determined as the associated program code of the program code.

[0131] Optionally, according to the obtained classification result, the program code to be verified is selected. For example, if the obtained classification result is that the program code is verified, the program code to be verified is selected from the program codes other than the program code that has been verified among the plurality of program codes; if the obtained classification result is that the program code is not verified, the program code to be verified is selected from the plurality of program codes that have not been verified.

[0132] In step S404, the associated program code is analyzed to obtain first initial logical description information.

[0133] In the technical solution provided by the above step S404 of the present disclosure, after obtaining the program code to be verified in the domain name system and the associated program code of the program code, the associated program code is analyzed to obtain the first initial logical description information, where the first initial logical description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain an execution result. Optionally, on the basis of obtaining the program code to be verified in the domain name system and the associated program code of the program code, the obtained associated program code is abstracted and summarized to obtain the first initial logical description information. For example, the associated program code is symbolically executed and traversed to obtain the behavior of the associated program code, and the calculation logic of the obtained associated program code under different input conditions is summarized as an abstract behavior description to obtain the first initial logical description information.

[0134] In step S406, a first memory identifier is added to the first initial logical description information to obtain first target logical description information.

[0135] In the technical solution provided in the step S406 of the present disclosure, after the first initial logic description information is obtained by analyzing the associated program code, the first memory identifier is added to the first initial logic description information, and the first target logic description information is obtained, wherein the first memory identifier is used to indicate the target memory object to which the first initial logic description information is stored. Optionally, on the basis of obtaining the first initial logic description information, the memory mark is introduced to the parameters and / or return values of each function in the first initial logic description information, and the memory mark is added to the first initial logic description information, so as to obtain the first target logic description information.

[0136] In the technical solution provided in the step S408 of the present disclosure, after the first memory identifier is added to the first initial logic description information to obtain the first target logic description information, the program code is verified based on the first target logic description information, and the verification result is obtained, wherein the verification result is used to indicate the correctness of the program code. Optionally, on the basis of obtaining the first target logic description information, the associated program code of the program code is verified. On the basis of verifying that the associated program code of the program code is correct, the program code is verified, and the verification result is obtained, that is, the correctness or incorrectness of the program code can be obtained.

[0137] In the technical solution provided in the step S408 of the present disclosure, after the first memory identifier is added to the first initial logic description information to obtain the first target logic description information, the program code is verified based on the first target logic description information, and the verification result is obtained, wherein the verification result is used to indicate the correctness of the program code. Optionally, on the basis of obtaining the first target logic description information, the associated program code of the program code is verified. On the basis of verifying that the associated program code of the program code is correct, the program code is verified, and the verification result is obtained, that is, the correctness or incorrectness of the program code can be obtained.

[0138] In the technical solution provided in the step S410 of the present disclosure, after the program code is verified based on the first target logic description information to obtain the verification result, the obtained verification result is returned to the domain name system.

[0139] In the technical solution provided in the step S410 of the present disclosure, after the program code is verified based on the first target logic description information to obtain the verification result, the obtained verification result is returned to the domain name system.

[0140] By the above steps S402 to S410 of the present disclosure, in the process of verifying the program code, the program code to be verified in the domain name system and the associated program code of the program code can be obtained. By analyzing the obtained associated program code, the first initial logical description information can be obtained. By adding the first memory identifier to the first initial logical description information obtained by analysis, the first target logical description information can be obtained. According to the first target logical description information obtained, the program code is verified, and the verification result is obtained and returned to the domain name system, so that the developer can obtain the verification result of the program code by logging into the domain name system. Since the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, and the program code is verified according to the first target logical description information after adding the first memory identifier, the correctness of the program code is obtained, so that the purpose of verifying the program code according to the first target logical description information with the added memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can support the abstract summary of any program code (including the program code of pointer alias), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code, and further solving the technical problem of large limitation of verifying the program code.

[0141] The present disclosure further provides a program code analysis method. FIG. 5 is a flowchart of a program code analysis method according to an embodiment of the present disclosure. As shown in FIG. 5, the method can include the following steps:

[0142] In step S502, the program code to be verified and the associated program code of the program code are obtained.

[0143] In the technical solution provided in the above step S502 of the present disclosure, the program code to be verified and the associated program code of the program code are obtained, wherein the program code is used to call the execution result of the associated program code in the execution process. Optionally, the plurality of program codes are classified to obtain a classification result, wherein the classification result can be used to indicate whether the program code is verified, for example, the classification result can be that the program code has been verified, or the program code has not been verified, which is only an example and is not limited. According to the obtained classification result, the program code to be verified is selected. On the basis of selecting the program code to be verified, the function module called by the program code to be verified is detected, and the program code corresponding to the detected function module called by the program code to be verified is determined as the associated program code of the program code.

[0144] Optionally, the program code to be verified is selected according to the obtained classification result. For example, if the obtained classification result is that the program code has completed verification, the program code to be verified is selected from the program codes other than the program code that has completed verification; if the obtained classification result is that the program code has not completed verification, the program code to be verified is selected from the program codes that have not completed verification.

[0145] In step S504, the associated program code is analyzed to obtain first initial logic description information.

[0146] In the technical solution provided in step S504 of the present disclosure, after the program code to be verified and the associated program code of the program code are obtained, the associated program code is analyzed to obtain first initial logic description information. The first initial logic description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain an execution result. Optionally, the first initial logic description information is obtained by abstractly summarizing the obtained associated program code on the basis of the obtained program code to be verified and the associated program code of the program code. For example, the first initial logic description information is obtained by performing symbolic execution traversal on the associated program code to obtain behaviors of the associated program code, and summarizing the computing logic of the obtained associated program code under different input conditions into abstract behavior description.

[0147] In step S506, a first memory identifier is added to the first initial logic description information to obtain first target logic description information.

[0148] In the technical solution provided in step S506 of the present disclosure, after the associated program code is analyzed to obtain first initial logic description information, a first memory identifier is added to the first initial logic description information to obtain first target logic description information. The first memory identifier is used to indicate a memory object to which the first initial logic description information is stored. Optionally, the first target logic description information is obtained by introducing a memory mark to parameters and / or return values of each function in the first initial logic description information and adding the memory mark to the first initial logic description information on the basis of the obtained first initial logic description information.

[0149] In step S508, the program code is analyzed based on the first target logic description information to obtain second initial logic description information.

[0150] In the technical solution provided in the step S508 of the present disclosure, after adding the first memory identifier into the first initial logical description information to obtain the first target logical description information, the program code is analyzed based on the first target logical description information to obtain the second initial logical description information, wherein the second initial logical description information is information used for describing the execution logic of the program code. Optionally, the second initial logical description information can be obtained by abstractly summarizing the upper-layer program code associated with the program code according to the first target logical description information on the basis of obtaining the first target logical description information. For example, the behavior of the upper-layer program code can be obtained by performing symbolic execution traversal on the upper-layer program code, and the calculation logic of the obtained upper-layer program code under different input conditions can be summarized into an abstract behavior description to obtain the initial logical description information of the upper-layer program code.

[0151] In the step S510 of the present disclosure, a second memory identifier is added into the second initial logical description information to obtain the second target logical description information.

[0152] In the technical solution provided in the step S510 of the present disclosure, after obtaining the second initial logical description information, a second memory identifier is added into the second initial logical description information to obtain the second target logical description information, wherein the second memory identifier is used for indicating the memory object to which the second initial logical description information is stored. Optionally, the second target logical description information can be obtained by introducing a memory mark into the parameters and / or return values of each function of the second initial logical description information and adding the memory mark into the second initial logical description information on the basis of obtaining the second initial logical description information.

[0153] By the above steps S502 to S510 of the present disclosure, in the process of analyzing the program code, the program code to be verified and the associated program code of the program code can be obtained. By analyzing the obtained associated program code, the first initial logical description information can be obtained. By adding the first memory identifier to the first initial logical description information obtained by analysis, the first target logical description information can be obtained. According to the obtained first target logical description information, the program code is analyzed, and the second initial logical description information can be obtained. By adding the second memory identifier to the obtained second initial logical description information, the second target logical description information can be obtained. Since in the process of analyzing the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, but also the program code is analyzed according to the first target logical description information after adding the first memory identifier, the second target logical description information can be obtained, and the second target logical description information is obtained by adding the second memory identifier to the obtained second target logical description information. Therefore, the purpose of analyzing the program code according to the first target logical description information with the memory identifier added is achieved. Since the first memory identifier added to the first initial logical description information can support the abstract summary of any program code (including the program code of pointer alias), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code, and further solving the technical problem of large limitation of verifying the program code.

[0154] The present disclosure further provides a program code analysis method. FIG. 6 is a flowchart of a program code analysis method according to an embodiment of the present disclosure. As shown in FIG. 6, the method can include the following steps:

[0155] In step S602, the program code to be verified and the associated program code of the program code are obtained by calling a first interface.

[0156] In the technical solution provided in the above step S602 of the present disclosure, the program code is used to call the execution result of the associated program code in the execution process, and the first interface can include a first parameter. The parameter value of the first parameter can be the program code and the associated program code. For example, the parameter value of the first parameter can be the code of the upper functional module and the code of the lower functional module. This is only an example and is not limited.

[0157] In this embodiment, the program code to be verified and the associated program code of the program code are obtained by calling the first interface. Optionally, the plurality of program codes are classified to obtain a classification result, where the classification result can be used to indicate whether the program code is verified, for example, the classification result can be that the program code has been verified or that the program code has not been verified, which is only an example and is not limited specifically. According to the obtained classification result, the program code to be verified is selected. On the basis of the program code to be verified, the function module called by the program code to be verified is detected, and the program code corresponding to the detected function module called by the program code to be verified is determined as the associated program code of the program code. Thus, by calling the first interface, the program code to be verified and the associated program code of the program code can be obtained.

[0158] It should be noted that the first interface described above can be an input interface between the client and the server. The first interface described above can be used to send the program code to be verified and the associated program code of the program code obtained by the client to the server. The server can be used to replace the client to execute the program code verification method in the present disclosure, thereby achieving the purpose of reducing the computing pressure of the client, which is only an example and is not limited specifically.

[0159] In step S604, the associated program code is analyzed to obtain first initial logic description information.

[0160] In the technical solution provided in step S604 of the present disclosure, after obtaining the program code to be verified and the associated program code of the program code by calling the first interface, optionally, on the basis of obtaining the program code to be verified and the associated program code of the program code, the obtained associated program code is abstracted and summarized to obtain first initial logic description information, where the first initial logic description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain an execution result. For example, the associated program code is symbolically executed and traversed to obtain the behavior of the associated program code, and the calculation logic of the obtained associated program code under different input conditions is summarized as an abstract behavior description to obtain the first initial logic description information.

[0161] In step S606, a first memory identifier is added to the first initial logic description information to obtain first target logic description information.

[0162] In the technical solution provided in the step S606 of the present disclosure, after the first initial logic description information is obtained by analyzing the associated program code, the first memory identifier is added to the first initial logic description information, and the first target logic description information is obtained, wherein the first memory identifier is used to indicate the target memory object to which the first initial logic description information is stored. Optionally, based on the first initial logic description information, the memory mark is introduced to the parameters and / or return values of each function in the first initial logic description information, and the memory mark is added to the first initial logic description information, so as to obtain the first target logic description information.

[0163] In the step S608, the program code is verified based on the first target logic description information, and a verification result is obtained.

[0164] In the technical solution provided in the step S608 of the present disclosure, after the first memory identifier is added to the first initial logic description information to obtain the first target logic description information, the program code is verified based on the first target logic description information, and a verification result is obtained, wherein the verification result is used to indicate the correctness of the program code. Optionally, based on the first target logic description information, the associated program code of the program code is verified. Based on the verification of the associated program code of the program code, the program code is verified, and the verification result is obtained, that is, the correctness or incorrectness of the program code is obtained.

[0165] In the step S610, the verification result is output by calling the second interface.

[0166] In the technical solution provided in the step S610 of the present disclosure, the second interface can include a second parameter, and the parameter value of the second parameter can be the verification result. For example, the parameter value of the second parameter can be the verification result of the correct program code, or the verification result of the incorrect program code, which is only used as an example and is not limited.

[0167] In this embodiment, after the program code is verified based on the first target logic description information to obtain the verification result, the obtained verification result can be output by calling the second interface.

[0168] It should be noted that the second interface can be an output interface between the client and the server. The second interface can be used to send the verification result of the program code obtained by the server by executing the program code verification method in the present disclosure to the client. The client can display the verification result of the program code in the graphical user interface, and the graphical user interface can be a picture displayed on the screen of a display device, which can be, but is not limited to, a notebook computer and a desktop computer, which is only used as an example and is not limited.

[0169] Through the above steps S602 to S610 of the present disclosure, in the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained by calling the first interface. The first initial logical description information can be obtained by analyzing the obtained associated program code. The first target logical description information can be obtained by adding the first memory identifier to the first initial logical description information obtained by analysis. The verification result can be obtained by verifying the program code according to the obtained first target logical description information, and the obtained verification result can be output by calling the second interface. Since the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information in the process of verifying the program code, and the program code is verified according to the first target logical description information after adding the first memory identifier, the correctness of the program code is obtained, so that the purpose of verifying the program code according to the first target logical description information after adding the memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support for any program code (including the program code of pointer alias), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code, and further solving the technical problem of large limitation of verifying the program code.

[0170] The present disclosure also provides a program code verification system. FIG. 7 is a schematic diagram of a program code verification system according to an embodiment of the present disclosure. As shown in FIG. 7, the method can include the following steps:

[0171] The client 702 is configured to upload the program code to be verified and the associated program code of the program code, wherein the program code is configured to call the execution result of the associated program code in the execution process.

[0172] In the technical solution provided by the client 702 of the present disclosure, the client can be at least one of the following devices: notebook computer, desktop computer, etc. This is only an example and is not limited.

[0173] In this embodiment, the plurality of program codes are classified to obtain a classification result, where the classification result can be used to indicate whether the program code has passed the verification, for example, the classification result can be that the program code has passed the verification, or the classification result can be that the program code has not passed the verification, which is only an example and is not limited specifically. According to the obtained classification result, the program code to be verified is selected. On the basis of the program code to be verified, the function module called by the program code to be verified is detected, and the program code corresponding to the detected function module called by the program code to be verified is determined as the associated program code of the program code. Thus, by using the client, the selected program code to be verified and the determined associated program code of the program code can be uploaded to the server.

[0174] The server 704 is configured to analyze the associated program code to obtain first initial logic description information, where the first initial logic description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain an execution result; add a first memory identifier to the first initial logic description information to obtain first target logic description information, where the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verify the program code based on the first target logic description information to obtain a verification result, where the verification result is used to indicate the correctness of the program code; and deliver the verification result to the client.

[0175] In the technical solution provided by the server 704 in the present disclosure, the server can be a cloud server or a local server, which is only an example and is not limited specifically.

[0176] In this embodiment, on the basis of the server receiving the program code to be verified and the associated program code of the program code, the server is controlled to analyze the associated program code to obtain the first initial logic description information. The server is controlled to add the first memory identifier to the first initial logic description information to obtain the first target logic description information. The server is controlled to verify the program code according to the first target logic description information to obtain the verification result.

[0177] In the verification system 700 of the program code in the disclosure, in the process of verifying the program code, the program code to be verified and the associated program code of the program code can be uploaded to the server by using the client. The first initial logical description information can be obtained by analyzing the associated program code by using the server. The first target logical description information can be obtained by adding the first memory identifier to the first initial logical description information obtained by analysis by using the server. The verification result can be obtained by verifying the program code according to the first target logical description information obtained by using the server, that is, the correctness of the program code can be obtained. Since in the process of verifying the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis by using the server to obtain the first target logical description information, but also the program code is verified according to the first target logical description information after adding the first memory identifier by using the server, so that the correctness of the program code is obtained, so that the program code can be verified according to the first target logical description information after adding the memory mark. The first memory identifier added to the first initial logical description information can realize the abstract summary support of any program code (including the program code of pointer alias), and the analysis engine of the code abstract summary does not need to be redesigned and expanded, so that the technical effect of reducing the limitation of verifying the program code is realized, and the technical problem of large limitation of verifying the program code is solved.

[0178] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the disclosure, such as data for verification, are information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0179] It should be noted that for the above-mentioned method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the disclosure is not limited by the described action order, because according to the disclosure, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily necessary for the disclosure.

[0180] Those skilled in the art can clearly understand that the method according to the above-mentioned embodiments can be realized by means of software on a general hardware platform, and of course, can also be realized by hardware. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) 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) to execute the program code verification method of each embodiment of the present disclosure.

[0181] The method embodiments provided by the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal, or a similar computing device. FIG. 8(a) shows a hardware structure block diagram of a computer terminal (or a mobile device) for implementing the program code verification method. As shown in FIG. 8(a), the computer terminal 80 (or a mobile device) can include one or more processors 802 (the processor 802 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 804 for storing data, and a transmission device 806 for communication functions. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art can understand that the structure shown in FIG. 8(a) is only schematic, and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 80 can include more or fewer components than those shown in FIG. 8(a), or have a different configuration from that shown in FIG. 8(a).

[0182] It should be noted that the one or more processors 802 and / or other data processing circuits described above can be referred to as "data processing circuits" herein. The data processing circuit can be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuit can be a single independent processing module, or all or part of any one of the other elements combined into the computer terminal 80 (or a mobile device). As referred to in the embodiments of the present disclosure, the data processing circuit controls as a processor (for example, the selection of a variable resistance terminal path connected to an interface).

[0183] The memory 804 can be used to store software programs and modules of application software, and program instructions / data storage means corresponding to the method in the embodiments of the present disclosure, and the processor 802 can execute various functional applications and data processing by running the software programs and modules stored in the memory 804, that is, implement the image generation method in the above embodiments. The memory 804 can include a high-speed random access memory, and can also include a non-volatile memory such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 804 can further include a memory remotely arranged with respect to the processor 802, which can be connected to the computer terminal 80 through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0184] The transmission device 806 is used to receive or send data via a network. The specific examples of the above network can include a wireless network provided by a communication provider of the computer terminal 80. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC) which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 806 can be a radio frequency (Radio Frequency, RF) module used for wireless communication with the Internet.

[0185] The display can be a touch screen type liquid crystal display (Liquid Crystal Display, LCD) which can enable a user to interact with the user interface of the computer terminal 80 (or mobile device).

[0186] The hardware structure diagram shown in FIG. 8(a) can not only be used as an exemplary block diagram of the above computer terminal 80 (or mobile device), but also as an exemplary block diagram of the above server. In an optional embodiment, FIG. 8(a) shows an embodiment in which the above computer terminal 80 (or mobile device) shown in FIG. 8(a) is used as a computing node in a computing environment 811. As shown in FIG. 8(b), the computing environment 811 includes a plurality of (shown as 810-1, 810-2, … in the figure) computing nodes (such as servers) running on a distributed network. The computing nodes all contain local processing and memory resources, and end users 812 can remotely run application programs or store data in the computing environment 811. The application programs can be provided as a plurality of services 820-1, 820-2, 820-3 and 820-4 in the computing environment 811, which represent services “8A”, “8D”, “8E” and “8H” respectively.

[0187] End users 812 can provide and access services through a web browser or other software application on a client, in some embodiments, provisioning and / or requests of end users 812 can be provided to ingress gateway 830. Ingress gateway 830 can include a corresponding proxy to handle provisioning and / or requests for services (one or more services provided in computing environment 811).

[0188] Services are provided or deployed according to various virtualization technologies supported by computing environment 811. In some embodiments, services can be provided according to virtual machine (VM)-based virtualization, container-based virtualization, and / or the like. Virtual machine-based virtualization can be emulating a real computer by initializing a virtual machine to execute programs and applications without directly touching any actual hardware resources. While a virtual machine is virtualized, according to container-based virtualization, a container can be launched to virtualize an entire operating system (OS) so that multiple workloads can run on a single OS instance.

[0189] In one embodiment of container-based virtualization, several containers of a service can be assembled into a Pod (e.g., a Kubernetes Pod). For example, as shown in FIG. 8(b), service 820-2 can be equipped with one or more Pods 840-1, 840-2, …, 840-N (collectively, Pods). A Pod can include a proxy 845 and one or more containers 842-1, 842-2, …, 842-M (collectively, containers). The one or more containers in a Pod handle requests related to one or more corresponding functions of the service, and the proxy 845 generally controls network functions related to the service, such as routing, load balancing, and the like. Other services can also be equipped with similar Pods.

[0190] In operation, executing a user request from an end user 812 can require invoking one or more services in computing environment 811, and executing one or more functions of a service can require invoking one or more functions of another service. As shown in FIG. 8(b), service “A” 820-1 receives a user request from end user 802 from ingress gateway 830, service “A” 820-1 can invoke service “D” 820-2, and service “D” 820-2 can request service “E” 820-3 to execute one or more functions.

[0191] The computing environment described above can be a cloud computing environment, the allocation of resources is managed by a cloud service provider, allowing the development of functions without considering the implementation, adjustment or expansion of servers. This computing environment allows developers to execute code that responds to events without building or maintaining complex infrastructure. Services can be divided into a set of functions that can automatically scale independently, rather than expanding a single hardware device to handle potential loads.

[0192] At present, with the increasing perfection and complexity of software systems, in order to ensure the correctness of the software system, a layered verification method with program automatic summarization capability is often used to perform formal verification on the program code that implements the software system.

[0193] However, the above verification method based on layering can only support program code with relatively simple memory operations and cannot support program code with more complex memory operations, such as program code with pointer aliasing, thereby causing the technical problem of great limitation in verifying program code.

[0194] The present disclosure provides a program code abstract summarization method compatible with pointer aliasing, which solves the technical problem of great limitation in verifying program code, and is different from the conventional solution that cannot verify program code according to the first target logic description information with added memory markers, thereby solving the technical problem of great limitation in verifying program code.

[0195] In the embodiments of the present disclosure, by extending the existing code summarization technology, a memory object marker mechanism is added to the first initial logic description information associated with the program code, thereby realizing abstract summarization support for any program code (e.g., program code including pointer aliasing), so that the behavior description of the code is more accurate, and thus the purpose of verifying program code according to the first target logic description information with added memory markers is achieved. Since the first memory marker added to the first initial logic description information can realize abstract summarization support for any program code (including program code with pointer aliasing), it is not necessary to redesign and extend the analysis engine for code abstract summarization, thereby realizing the technical effect of reducing the limitation of verifying program code, and further solving the technical problem of great limitation in verifying program code.

[0196] In this embodiment, FIG. 9(a) is a schematic diagram of verification effect of program code according to an embodiment of the present disclosure. As shown in FIG. 9(a), on the operation interface in the mobile device 901, by clicking the "verify" button, the verification result of the program code can be displayed on the operation interface, and by clicking the "view" button, the error part of the program code can be displayed on the operation interface, for example, the input parameter combination that causes the program code error can be displayed on the operation interface. In addition, by clicking the "return" button, the selection interface of the program code can be returned.

[0197] In this embodiment, the associated program code of the above program code can be the getMinPos function as shown in FIG. 9(b). FIG. 9(b) is a schematic diagram of branching of program code according to an embodiment of the present disclosure. In the code implementing the function getMinPos, there are the following nodes: node b1, node b2, node b 21 and node b 22 , node 2 and node 3. Among them, node 3 is the last node in the program code of the function getMinPos. The function getMinPos can be defined in dependence on the following two types: Point struct{x: int, y: int}, which can be used to represent a point on a two-dimensional plane; Segment struct{data: *Point[2]}, which can be used to represent a line segment between two points.

[0198] It should be noted that the above function getMinPos, given a *Segment c and int x, can return the smallest endpoint in c whose x-coordinate is greater than or equal to x. If the entire Segment is to the left of x, return nil.

[0199] In this embodiment, the above program code to be verified can be the align function as shown in FIG. 9(c). The above target pointer can be c as shown in FIG. 9(c). FIG. 9(c) is a schematic diagram of branching of program code according to an embodiment of the present disclosure. In the code implementing the function align, node 8 is the last node in the program code of the function align. The function align can be defined in dependence on the following two types: Point struct{x: int, y: int}, which can be used to represent a point on a two-dimensional plane; Segment struct{data: *Point[2]}, which can be used to represent a line segment between two points.

[0200] It should be noted that the above function align, given a *Segment c, can find the smallest endpoint in c whose x-coordinate is greater than or equal to 0, and align its x-coordinate with 0.

[0201] Further, since the function align calls the function getMinPos, when verifying the application of modularization to the code, the behavior of the function getMinPos needs to be summarized as getMinPosSpec first, and then the behavior of the function align is analyzed. In the related art, the computing logic of the function getMinPos can often be abstractly summarized, but when applied to the analysis of the behavior of the function align, an analysis error caused by not correctly handling pointer aliasing can occur.

[0202] For example, in the related art, a piece of code is abstractly summarized mainly through the technology of symbolic execution. For example, for each branching statement, it is determined whether there is a set of inputs that satisfies the corresponding condition. If there is, the content after the branching is analyzed, and the assignment, return, and other operations are simulated. For the function getMinPos, the symbolic execution handles the if-then-else branching structure in the code, and the following three cases are considered:

[0203] Case one, the execution path 0→b1→3, corresponding to the condition x<=c.data[0].x. In this case, there are assignments of x and c such that the condition is true, and the computing result of the branching is c.data[0];

[0204] Case two, the execution path 0→b2→b 21 2→3, corresponding to the condition x>c.data[0].x&&x<c.data[1].x. In this case, there are assignments of x and c such that the condition is true, and the computing result of the branching is c.data[1];

[0205] Case three, the execution path 0→b2→b 22 2→3, corresponding to the condition x>c.data[0].x&&x>=c.data[1].x. In this case, there are assignments of x and c such that the condition is true, and the computing result of the branching is nil, which is a special symbol indicating an empty result.

[0206] In summary, the related scheme traverses the program branch by branch, finds all feasible execution paths, and records the corresponding branch conditions and calculation results. The result of the abstract summary of the program behavior is a simplified schematic diagram of the branches of the program code, for example, the branches of the function getMinPos can be shown in FIG. 9(d). FIG. 9(d) is a schematic diagram of a branch of a program code according to related technologies, which abstractly describes that getMinPosSpec depends on an abstract data type (for example, AbsSegment). AbsSegment and Segment in the actual code are equivalent, but it avoids the use of pointers. This is a general practice of behavior description, which limits the data type to a more abstract field, so that efficient automatic reasoning can be performed for the data type. However, after calling the function getMinPosSpec from the function align(), it can be seen that the p obtained and the original c are independent, and the association between the two established by the pointer has disappeared. Therefore, the modification made by p.x in the function align will not be reflected as a modification of c, thereby causing an analysis error of the behavior of the function align after using the function getMinPosSpec. This is the reason why the related scheme cannot correctly summarize the code when there are pointers with the same name in the code.

[0207] That is, the first initial logic description information can be the abstract description getMinPosSpec as shown in FIG. 9(e), and the second initial logic description information can be the function align that calls the function getMinPosSpec as shown in FIG. 9(e). FIG. 9(e) is a schematic diagram of a code behavior description according to an embodiment of the present disclosure. The function align that calls the function getMinPos cannot be directly abstractly summarized as the function align that calls the function getMinPosSpec.

[0208] However, in the present disclosure, a memory marker is introduced for each function parameter and return value in the behavior description of the function getMinPos and the symbolic execution process of the function align, thereby assisting the analysis of pointer aliasing. For example, the following memory markers are introduced for each function parameter and return value:

[0209] Marker one, first memory identification. For example, the first memory identification can be represented by ref(v), which can be used to represent that the memory object at this position is indexed by the pointer v;

[0210] Marker two, pointer identification. For example, the pointer identification can be represented by inhib, which can be used to represent that the pointer should not be used;

[0211] After the memory tag is introduced, the return value Point of getMinPosSpec is added with a ref tag, thereby assisting the analysis of the behavior of the function align. The following is an analysis of the symbolic execution process of the function align:

[0212] Assuming that 0 <= c.data[0].x is true at this time, the assignment statement after node 5 is executed. At this time, there is only one object c in the memory, and the value of c is the initial value of the call to foo, and the Segment stores the data {data: [Point{x: x0, y: y0}, Point{x: x1, y: y1}]}. After the call to getMinPosSpec, the return value c.data[0] is obtained, which is placed in a new memory b, at this time, p = b, and the data stored in b is Point{x: x0, y: y0}, and the tag of each memory object is b: ref(c.data[0]), c: inhib, that is, b is indexed by c, and therefore c cannot be accessed subsequently. After the return value c.data[0] is obtained, node 6 is entered for branch judgment, and in the case of p!= nil, node 7 is entered, and after entering node 7, p.x is modified, and therefore the data stored in b is updated to Point{x: 0, y: y0}. After p.x is modified, node 8 is entered, and the foo function ends, at this time, the content in b is written back to the pointer that indexes it, and therefore the data stored in b is Point{x: x0, y: y0}, and the data stored in c is updated to {data: [Point{x: 0, y: y0}, Point{x: x1, y: y1}]}. As can be seen, after the memory tag mechanism proposed in the present disclosure is adopted, the symbolic execution of the function align can correctly cope with the case of pointer aliasing.

[0213] That is, the first target logical description information described above can be an abstract description getMinPosSpec + memory object tag (tag) as shown in FIG. 9(f), and the second target logical description information described above can be a function align that calls the function getMinPosSpec using the tag mechanism as shown in FIG. 9(f), and FIG. 9(f) is a schematic diagram of another code behavior description according to an embodiment of the present disclosure. The function align that calls the function getMinPos can be abstractly summarized as the function align that calls the function getMinPosSpec using the tag mechanism.

[0214] In the embodiments of the present disclosure, for the memory object with an alias pointer, the pointer pointing to it is recorded explicitly, and the latest content is stored to the corresponding pointer at the end of the function, so that each alias pointer points to the consistent result, thus achieving the purpose that the program code can be verified according to the first target logical description information added with the first memory mark. Since the first memory mark added to the first initial logical description information can realize the abstract summary support for any program code (including the program code with a pointer alias), and the analysis engine for the code abstract summary does not need to be redesigned and expanded, the technical effect that the limitation of the program code verification can be reduced is realized, and thus the technical problem of large limitation of the program code verification is solved.

[0215] According to the embodiments of the present disclosure, a program code verification device for implementing the program code verification method shown in FIG. 2 is also provided.

[0216] FIG. 10 is a schematic diagram of a program code verification device according to an embodiment of the present disclosure. As shown in FIG. 10, the program code verification device 1000 can include a first obtaining component 1002, a first analyzing component 1004, a first adding component 1006, and a first verifying component 1008.

[0217] The first obtaining component 1002 is configured to obtain program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process.

[0218] The first analyzing component 1004 is configured to analyze the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information describing an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result.

[0219] The first adding component 1006 is configured to add a first memory mark to the first initial logical description information to obtain first target logical description information, wherein the first memory mark is used to indicate a target memory object to which the first initial logical description information is stored.

[0220] The first verifying component 1008 is configured to verify the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0221] It should be noted that the first obtaining component 1002, the first analyzing component 1004, the first adding component 1006 and the first verifying component 1008 correspond to steps S202 to S208 in Embodiment 2, and the four components have the same instances and application scenarios as the corresponding steps, but are not limited to the above-mentioned embodiments 2. It should be noted that the above-mentioned components can be hardware components or software components stored in the memory (for example, the memory 802) and processed by one or more processors (for example, the processors 802a, 802b, …, 802n), and the above-mentioned components can also be a part of the device and can run in the computer terminal 80 provided in the embodiments.

[0222] According to the embodiments of the present disclosure, a program code verification device for implementing the program code verification method shown in FIG. 3 is also provided.

[0223] FIG. 11 is a schematic diagram of another program code verification device according to an embodiment of the present disclosure. As shown in FIG. 11, the network live room scene generation device 1100 can include a second obtaining component 1102, a second analyzing component 1104, a second adding component 1106 and a second verifying component 1108.

[0224] The second obtaining component 1102 is configured to obtain a program code to be verified and an associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process, and the associated program code includes a target pointer used to index a target memory object.

[0225] The second analyzing component 1104 is configured to analyze the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result.

[0226] The second adding component 1106 is configured to add a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored, and the target pointer is not included in the first initial logical description information.

[0227] The second verifying component 1108 is configured to verify the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0228] It should be noted that the second obtaining component 1102, the second analyzing component 1104, the second adding component 1106 and the second verifying component 1108 correspond to steps S302 to S308 in Embodiment 2, and the three components have the same instances and application scenarios as the corresponding steps, but are not limited to the above-mentioned embodiment 2. It should be noted that the above-mentioned components can be hardware components or software components stored in the memory (for example, the memory 802) and processed by one or more processors (for example, the processors 802a, 802b, …, 802n), or the above-mentioned components can be a part of the device and can run in the computer terminal 80 provided in the embodiment.

[0229] According to the embodiments of the present disclosure, a domain name system program code verification device for implementing the domain name system program code verification method shown in FIG. 4 is also provided.

[0230] FIG. 12 is a schematic diagram of a domain name system program code verification device according to an embodiment of the present disclosure. As shown in FIG. 12, the domain name system program code verification device 1200 can include a third obtaining component 1202, a third analyzing component 1204, a third adding component 1206, a third verifying component 1208 and a returning component 1210.

[0231] The third obtaining component 1202 is configured to obtain program code to be verified in the domain name system and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process.

[0232] The third analyzing component 1204 is configured to analyze the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result.

[0233] The third adding component 1206 is configured to add a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored.

[0234] The third verifying component 1208 is configured to verify the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0235] The returning component 1210 is configured to return the verification result to the domain name system.

[0236] It should be noted that the third obtaining component 1202, the third analyzing component 1204, the third adding component 1206, the third verifying component 1208 and the returning component 1210 correspond to steps S502 to S510 in Embodiment 2, and the five components have the same instances and application scenarios as the corresponding steps, but are not limited to the above-mentioned Embodiment 2. It should be noted that the above-mentioned components can be hardware components or software components stored in the memory (for example, the memory 802) and processed by one or more processors (for example, the processors 802a, 802b, …, 802n), and the above-mentioned components can also be run in the computer terminal 80 provided in the embodiments as part of the device.

[0237] FIG. 13 is a schematic diagram of a program code analysis apparatus according to an embodiment of the present disclosure. As shown in FIG. 13, the program code analysis apparatus 1300 can include a fourth obtaining component 1302, a fourth analyzing component 1304, a fourth adding component 1306, a fifth analyzing component 1308 and a fifth adding component 1310.

[0238] The fourth obtaining component 1302 is configured to obtain program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process.

[0239] The fourth analyzing component 1304 is configured to analyze the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result.

[0240] The fourth adding component 1306 is configured to add a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored.

[0241] The fifth analyzing component 1308 is configured to analyze the program code based on the first target logic description information to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code.

[0242] The fifth adding component 1310 is configured to add a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0243] It should be noted that the fourth obtaining component 1302, the fourth analyzing component 1304, the fourth adding component 1306, the fifth analyzing component 1308, and the fifth adding component 1310 correspond to steps S602 to S610 in Embodiment 2, and the two components have the same instances and application scenarios as the corresponding steps, but are not limited to the above-mentioned Embodiment 2. It should be noted that the above-mentioned components can be hardware components or software components stored in the memory (for example, the memory 802) and processed by one or more processors (for example, the processors 802a, 802b, …, 802n), and the above-mentioned components can also be run in the computer terminal 80 provided in the embodiment as part of the device.

[0244] FIG. 14 is a schematic diagram of a program code analysis device according to an embodiment of the present disclosure. As shown in FIG. 14, the program code analysis device 1400 can include a fifth obtaining component 1402, a fifth analyzing component 1404, a fifth adding component 1406, a fifth verifying component 1408, and an output component 1410.

[0245] The fifth obtaining component 1402 is configured to obtain, by calling a first interface, program code to be verified and associated program code of the program code, where the program code is used to call an execution result of the associated program code in an execution process, and the first interface includes a first parameter, and a parameter value of the first parameter is the program code and the associated program code.

[0246] The fifth analyzing component 1404 is configured to analyze the associated program code to obtain first initial logic description information, where the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result.

[0247] The fifth adding component 1406 is configured to add a first memory identifier to the first initial logic description information to obtain first target logic description information, where the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored.

[0248] The fifth verifying component 1408 is configured to verify the program code based on the first target logic description information to obtain a verification result, where the verification result is used to indicate correctness of the program code.

[0249] The output component 1410 is configured to output the verification result by calling a second interface, where the second interface includes a second parameter, and a parameter value of the second parameter is the verification result.

[0250] It should be noted that the fifth acquisition component 1402, the fifth analysis component 1404, the fifth adding component 1406, the fifth verification component 1408 and the output component 1410 correspond to steps S702 to S710 in Embodiment 2, and the two components and the corresponding steps have the same instances and application scenarios, but are not limited to the above-mentioned embodiment 2. It should be noted that the above-mentioned components can be hardware components or software components stored in the memory (for example, the memory 802) and processed by one or more processors (for example, the processors 802a, 802b, …, 802n), and the above-mentioned components can also be run in the computer terminal 80 provided in the embodiment as part of the device.

[0251] In the embodiment of the present disclosure, in the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained. The first initial logical description information can be obtained by analyzing the obtained associated program code. The first target logical description information can be obtained by adding the first memory identifier to the first initial logical description information obtained by analysis. According to the first target logical description information obtained, the program code is verified, and the verification result can be obtained, that is, the correctness of the program code can be obtained. Since in the process of verifying the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, but also the program code is verified according to the first target logical description information after adding the first memory identifier, thereby obtaining the correctness of the program code, so that the purpose of verifying the program code according to the first target logical description information after adding the memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can support the abstract summary of any program code (including the program code of pointer alias), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code, and further solving the technical problem of large limitation of verifying the program code.

[0252] It should be noted that the preferred embodiments involved in the above embodiments of the present disclosure have the same scheme, application scenario and implementation process as provided in Embodiment 1, but are not limited to the scheme provided in Embodiment 1.

[0253] The embodiment of the present disclosure can provide an electronic device, which can be any one of the electronic devices in the electronic device group. Alternatively, in the embodiment, the above-mentioned electronic device can also be replaced by a terminal device such as a mobile terminal.

[0254] Alternatively, in the embodiment, the above-mentioned electronic device can be located in at least one network device of a plurality of network devices of a computer network.

[0255] In the embodiment, the computer terminal can execute the program code in the method.

[0256] Optionally, FIG. 15 is a block diagram of an electronic device for verifying program code according to an embodiment of the present disclosure. As shown in FIG. 15, the electronic device A can include one or more (only one is shown in the figure) processors 1502, a memory 1504, a storage controller, and a peripheral interface, wherein the peripheral interface is connected with a radio frequency module, an audio module, and a display.

[0257] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the method and device in the embodiments of the present disclosure. The processor executes various functions and data processing by running the software programs and modules stored in the memory, that is, implements the method in the above embodiments. The memory can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to a computer terminal (for example, the computer terminal 80 shown in FIG. 8(a)) through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0258] The processor can call the information and application programs stored in the memory to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call the execution result of the associated program code in the execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0259] Optionally, the processor can further execute the program code of the following steps: determining the stored data in the associated program code in the first initial logic description information, wherein the stored data in the associated program code includes function parameters and / or return values; adding the first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0260] Optionally, the processor can further execute program codes of the following steps: determining a target memory object to which the stored data is stored; determining a target pointer corresponding to the target memory object, wherein the target pointer is used to index the target memory object; adding the first memory identifier to the stored data in the associated program code based on the target pointer, to obtain the first target logical description information.

[0261] Optionally, the processor can further execute program codes of the following steps: generating the first memory identifier based on the target pointer; adding the generated first memory identifier to the stored data in the associated program code, to obtain the first target logical description information.

[0262] Optionally, the processor can further execute program codes of the following steps: determining a pointer identifier corresponding to the target pointer, wherein the pointer identifier is used to indicate that the target pointer is prohibited from being used; adding the first memory identifier and the pointer identifier to the stored data in the associated program code based on the target pointer, to obtain the first target logical description information.

[0263] Optionally, the processor can further execute program codes of the following steps: in a process of analyzing the program code based on the first target logical description information, if the stored data stored in the target memory object is updated, associating the updated stored data to the target pointer.

[0264] Optionally, the processor can further execute program codes of the following steps: in a case where a return value in the program code is updated and a memory object to which the return value in the program code is stored is the same as the target memory object, updating the stored data stored in the target memory object based on the return value in the program code.

[0265] Optionally, the processor can further execute program codes of the following steps: analyzing the program code based on the first target logical description information to obtain second initial logical description information, wherein the second initial logical description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logical description information to obtain second target logical description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logical description information is stored; and verifying the program code by using the second target logical description information to obtain a verification result.

[0266] Optionally, the processor can further execute program codes of the following steps: determining the stored data in the program code in the second initial logical description information, wherein the stored data in the program code includes function parameters and / or return values; and adding the second memory identifier to the stored data in the program code to obtain the second target logical description information.

[0267] Optionally, the processor can further execute program codes of the following steps: if the second target logic description information meets the standard logic description information, determining that the verification result is that the program code is correct; if the second target logic description information does not meet the standard logic description information, determining that the verification result is that the program code is incorrect.

[0268] Optionally, the processor can call information and application programs stored in the memory to execute the following steps: obtaining a program code to be verified and associated program codes of the program code, wherein the program code is used to call an execution result of the associated program codes in an execution process, and the associated program codes include a target pointer used to index a target memory object; analyzing the associated program codes to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program codes, and the associated program codes are used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate the target memory object to which the first initial logic description information is stored, and the target pointer is not included in the first initial logic description information; and verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0269] Optionally, the processor can call information and application programs stored in the memory to execute the following steps: obtaining a program code to be verified and associated program codes of the program code in a domain name system, wherein the program code is used to call an execution result of the associated program codes in an execution process; analyzing the associated program codes to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program codes, and the associated program codes are used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code; and returning the verification result to the domain name system.

[0270] Optionally, the processor can call information and application programs stored in the memory to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; based on the first target logic description information, analyzing the program code to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0271] Optionally, the processor can call information and application programs stored in the memory to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; based on the first target logic description information, analyzing the program code to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0272] According to the embodiment of the present disclosure, a program code verification method is provided. In the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained. The obtained associated program code is analyzed to obtain first initial logical description information. The first memory identifier is added to the first initial logical description information obtained by analysis to obtain first target logical description information. According to the first target logical description information obtained, the program code is verified to obtain a verification result, that is, the correctness of the program code can be obtained. Since the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, and the program code is verified according to the first target logical description information after the first memory identifier is added, the correctness of the program code is obtained, so that the purpose of verifying the program code according to the first target logical description information with the added memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support for any program code (including the program code with pointer aliasing), and the analysis engine for code abstract summary does not need to be redesigned and expanded, the technical effect of reducing the limitation of verifying the program code is realized, and the technical problem of large limitation of verifying the program code is solved.

[0273] Those skilled in the art can understand that the structure shown in FIG. 16 is only schematic, and the computer terminal B can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD, and the like. FIG. 16 does not limit the structure of the above computer terminal B. For example, the computer terminal B can further include more or less components (such as a network interface, a display device, etc.) than those shown in FIG. 16, or have a different configuration from that shown in FIG. 16.

[0274] Optionally, FIG. 16 is a structural block diagram of a computer terminal according to an embodiment of the present disclosure. As shown in FIG. 16, the computer terminal B can include one or more (only one is shown in the figure) processors 1602, a memory 1604, and a coupler 1606. The display can be connected to the processor 1602 through a user interface.

[0275] The memory can be configured to store software programs and modules, such as program instructions / modules corresponding to the live room scene generation method and device in the embodiments of the present disclosure. The processor executes the software programs and modules stored in the memory, thereby performing various functions and data processing, that is, implementing the live room scene generation method described above. The memory can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, and the remote memory can be connected to the computer terminal B through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0276] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; and verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0277] Optionally, the processor can further execute program codes of the following steps: determining stored data in the associated program code in the first initial logic description information, wherein the stored data in the associated program code includes function parameters and / or return values; and adding the first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0278] Optionally, the processor can further execute program codes of the following steps: determining a target memory object to which the stored data is stored; determining a target pointer corresponding to the target memory object, wherein the target pointer is used to index the target memory object; and adding the first memory identifier to the stored data in the associated program code based on the target pointer to obtain the first target logic description information.

[0279] Optionally, the processor can further execute program codes of the following steps: generating the first memory identifier based on the target pointer; and adding the generated first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0280] Optionally, the processor can further execute program codes of the following steps: determining a pointer identifier corresponding to the target pointer, wherein the pointer identifier is used to indicate that the target pointer is prohibited from being used; and adding a first memory identifier to the stored data in the associated program code based on the target pointer to obtain first target logical description information, including: adding the first memory identifier and the pointer identifier to the stored data in the associated program code based on the target pointer to obtain the first target logical description information.

[0281] Optionally, the processor can further execute program codes of the following steps: in the process of analyzing the program code based on the first target logical description information, if the stored data in the target memory object is updated, associating the updated stored data to the target pointer.

[0282] Optionally, the processor can further execute program codes of the following steps: in the case that the return value in the program code is updated and the memory object to which the return value in the program code is stored is the same as the target memory object, updating the stored data in the target memory object based on the return value in the program code.

[0283] Optionally, the processor can further execute program codes of the following steps: analyzing the program code based on the first target logical description information to obtain second initial logical description information, wherein the second initial logical description information is information used to describe the execution logic of the program code; adding a second memory identifier to the second initial logical description information to obtain second target logical description information, wherein the second memory identifier is used to indicate the memory object to which the second initial logical description information is stored; and verifying the program code by using the second target logical description information to obtain a verification result.

[0284] Optionally, the processor can further execute program codes of the following steps: determining the stored data in the program code in the second initial logical description information, wherein the stored data in the program code includes function parameters and / or return values; and adding the second memory identifier to the stored data in the program code to obtain the second target logical description information.

[0285] Optionally, the processor can further execute program codes of the following steps: if the second target logical description information meets the standard logical description information of the program code, determining that the verification result is that the program code is correct; and if the second target logical description information does not meet the standard logical description information, determining that the verification result is that the program code is incorrect.

[0286] Optionally, the processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call the execution result of the associated program code in the execution process, and the associated program code includes a target pointer used to index a target memory object; analyzing the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate the target memory object to which the first initial logical description information is stored, and the target pointer is not included in the first initial logical description information; verifying the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0287] Optionally, the processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call the execution result of the associated program code in the execution process; analyzing the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information used to describe the execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate the target memory object to which the first initial logical description information is stored; verifying the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code; and returning the verification result to the domain name system.

[0288] Optionally, the processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; based on the first target logic description information, analyzing the program code to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0289] Optionally, the processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; based on the first target logic description information, analyzing the program code to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0290] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments can be completed by instructing the terminal device related hardware through a program, and the program can be stored in a computer readable storage medium, which can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0291] The embodiments of the present disclosure further provide a computer readable storage medium. Optionally, in the embodiments, the computer readable storage medium can be used to save the program code executed by the method provided by the above-mentioned embodiments.

[0292] Optionally, in the embodiments, the storage medium can be located in any one of the electronic devices in the group of electronic devices in the computer network, or in any one of the mobile terminals in the group of mobile terminals.

[0293] Optionally, in the embodiments, the computer readable storage medium is configured to store program code for performing the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; and verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0294] Optionally, the computer readable storage medium can further execute program code for performing the following steps: in the first initial logic description information, determining stored data in the associated program code, wherein the stored data in the associated program code includes function parameters and / or return values; and adding the first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0295] Optionally, the computer readable storage medium can further execute program code for performing the following steps: determining a target memory object to which the stored data is stored; determining a target pointer corresponding to the target memory object, wherein the target pointer is used to index the target memory object; and based on the target pointer, adding the first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0296] Optionally, the computer readable storage medium can further execute program code for performing the following steps: generating the first memory identifier based on the target pointer; and adding the generated first memory identifier to the stored data in the associated program code to obtain the first target logic description information.

[0297] Optionally, the computer readable storage medium can further execute program codes of the following steps: determining a pointer identifier corresponding to the target pointer, wherein the pointer identifier is used to indicate that the target pointer is prohibited from being used; and adding a first memory identifier to the stored data in the associated program code based on the target pointer to obtain first target logical description information, including: adding the first memory identifier and the pointer identifier to the stored data in the associated program code based on the target pointer to obtain the first target logical description information.

[0298] Optionally, the computer readable storage medium can further execute program codes of the following steps: in the process of analyzing the program code based on the first target logical description information, if the stored data in the target memory object is updated, associating the updated stored data to the target pointer.

[0299] Optionally, the computer readable storage medium can further execute program codes of the following steps: in the case that the return value in the program code is updated and the memory object to which the return value in the program code is stored is the same as the target memory object, updating the stored data in the target memory object based on the return value in the program code.

[0300] Optionally, the computer readable storage medium can further execute program codes of the following steps: analyzing the program code based on the first target logical description information to obtain second initial logical description information, wherein the second initial logical description information is information used to describe the execution logic of the program code; adding a second memory identifier to the second initial logical description information to obtain second target logical description information, wherein the second memory identifier is used to indicate the memory object to which the second initial logical description information is stored; and verifying the program code by using the second target logical description information to obtain a verification result.

[0301] Optionally, the computer readable storage medium can further execute program codes of the following steps: determining the stored data in the program code in the second initial logical description information, wherein the stored data in the program code includes function parameters and / or return values; and adding the second memory identifier to the stored data in the program code to obtain the second target logical description information.

[0302] Optionally, the computer readable storage medium can further execute program codes of the following steps: if the second target logical description information meets the standard logical description information of the program code, determining that the verification result is that the program code is correct; and if the second target logical description information does not meet the standard logical description information, determining that the verification result is that the program code is incorrect.

[0303] As an optional example, the computer readable storage medium is configured to store program code for performing the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process, and the associated program code includes a target pointer for indexing a target memory object; analyzing the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information for describing an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored, and the target pointer is not included in the first initial logical description information; and verifying the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code.

[0304] As an optional example, the computer readable storage medium is configured to store program code for performing the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information for describing an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored; verifying the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate the correctness of the program code; and returning the verification result to the domain name system.

[0305] As an optional example, the computer readable storage medium is configured to store program code for performing the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; performing analysis on the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information for describing an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; performing analysis on the program code based on the first target logic description information to obtain second initial logic description information, wherein the second initial logic description information is information for describing an execution logic of the program code; and adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0306] As an optional example, the computer readable storage medium is configured to store program code for performing the following steps: obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; performing analysis on the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information for describing an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; performing analysis on the program code based on the first target logic description information to obtain second initial logic description information, wherein the second initial logic description information is information for describing an execution logic of the program code; and adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

[0307] Embodiments of the present disclosure also provide a computer program product. Optionally, in the present embodiment, the computer program product can include computer instructions, and the computer instructions, when executed by a processor, implement the method provided by the above-mentioned embodiments.

[0308] The embodiment of the present disclosure further provides a computer program product. Optionally, the computer program product can include a nonvolatile computer readable storage medium, which can be used to store a computer program, and the computer program is executed by a processor to implement the method provided by the above embodiment.

[0309] The embodiment of the present disclosure further provides a computer program. Optionally, in the embodiment, the computer program is executed by a processor to implement the method provided by the above embodiment.

[0310] The serial numbers of the embodiments of the present disclosure are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0311] In the above 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 related description of other embodiments.

[0312] In several embodiments provided by the present disclosure, it should be understood that the disclosed technology can be implemented in other ways. Of course, the embodiment described above is only a schematic and exemplary, for example, the division of units is only a logical function division, and there can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, unit or module, and can be electrical or other forms.

[0313] 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, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment.

[0314] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0315] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present disclosure, essentially or in other words, the part that contributes to the prior art or the whole 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 a number of 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 aforementioned storage medium includes: a U disk, a read-only memory (ROM, for short), a random access memory (RAM, for short), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0316] The above only describes the preferred embodiments of the present disclosure, and it should be noted that, for those skilled in the art, without departing from the principles of the present disclosure, a number of improvements and refinements can be made, and these improvements and refinements should also be considered as the protection scope of the present disclosure. Industrial applicability

[0317] The scheme provided by the embodiments of the present disclosure can be applied to the verification process of the program code of a software system. In the process of verifying the program code, the program code to be verified and the associated program code of the program code can be obtained. The first initial logical description information can be obtained by analyzing the obtained associated program code. The first memory identifier can be added to the first initial logical description information obtained by analysis, and the first target logical description information can be obtained. According to the obtained first target logical description information, the program code is verified, and the verification result can be obtained, that is, the correctness of the program code can be obtained. Since, in the process of verifying the program code, not only the first memory identifier is added to the first initial logical description information obtained by analysis to obtain the first target logical description information, but also the program code is verified according to the first target logical description information after adding the first memory identifier, the correctness of the program code is obtained, so that the purpose of verifying the program code according to the first target logical description information after adding the memory identifier is achieved. Since the first memory identifier added to the first initial logical description information can realize the abstract summary support for any program code (including the program code of pointer alias), it is not necessary to redesign and expand the analysis engine of the code abstract summary, thereby realizing the technical effect of reducing the limitation of verifying the program code, and further solving the technical problem of large limitation of verifying the program code.

Claims

1. A method for verifying program code, comprising: obtaining program code to be verified and associated program code of the program code, wherein the program code is configured to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information used to describe an execution logic of the associated program code, and the associated program code is configured to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored; verifying the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code.

2. The method of claim 1, wherein, adding a first memory identifier to the first initial logical description information to obtain first target logical description information, comprising: determining stored data in the associated program code in the first initial logical description information, wherein the stored data in the associated program code includes function parameters and / or return values; adding the first memory identifier to the stored data in the associated program code to obtain the first target logical description information.

3. The method of claim 2, wherein, adding the first memory identifier to the stored data in the associated program code to obtain the first target logical description information, comprising: determining the target memory object to which the stored data is stored; determining a target pointer corresponding to the target memory object, wherein the target pointer is used to index the target memory object; adding the first memory identifier to the stored data in the associated program code based on the target pointer to obtain the first target logical description information.

4. The method of claim 3, wherein, The method further comprises: determining a pointer identifier corresponding to the target pointer, wherein the pointer identifier is used to indicate that the target pointer is prohibited from being used; adding the first memory identifier and the pointer identifier to the stored data in the associated program code based on the target pointer to obtain the first target logical description information.

5. The method of claim 3, wherein, The method further comprises: if the stored data stored in the target memory object is updated in a process of analyzing the program code based on the first target logical description information, associating the updated stored data to the target pointer.

6. The method of claim 5, wherein, The method further comprises: if a return value in the program code is updated and a memory object to which the return value in the program code is stored is the same as the target memory object, updating the stored data stored in the target memory object based on the return value in the program code.

7. The method of claim 3, wherein, The associated program code includes the target pointer, and the first initial logical description information does not include the target pointer.

8. The method of any one of claims 1 to 7, wherein, verifying the program code based on the first target logic description information, to obtain a verification result, comprising: analyzing the program code based on the first target logic description information, to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information, to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored; verifying the program code by using the second target logic description information, to obtain the verification result.

9. The method of claim 8, wherein, adding a second memory identifier to the second initial logic description information, to obtain second target logic description information, comprising: determining stored data in the program code in the second initial logic description information, wherein the stored data in the program code includes function parameters and / or return values; adding the second memory identifier to the stored data in the program code, to obtain the second target logic description information.

10. The method of claim 8, wherein, verifying the program code by using the second target logic description information, to obtain the verification result, comprising: if the second target logic description information meets standard logic description information of the program code, determining that the verification result is that the program code is correct; if the second target logic description information does not meet the standard logic description information, determining that the verification result is that the program code is incorrect.

11. A verification method of program code, comprising: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process, and the associated program code includes a target pointer used to index a target memory object; analyzing the associated program code, to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, the associated program code is used to execute according to the execution logic to obtain the execution result, and the target pointer is not included in the first initial logic description information; adding a first memory identifier to the first initial logic description information, to obtain first target logic description information, wherein the first memory identifier is used to indicate the target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information, to obtain a verification result, wherein the verification result is used to indicate correctness of the program code.

12. A verification method of program code of a domain name system, comprising: obtaining program code to be verified in the domain name system and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code; and returning the verification result to the domain name system.

13. An analysis method of program code, comprising: obtaining program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a memory object to which the first initial logic description information is stored; analyzing the program code based on the first target logic description information to obtain second initial logic description information, wherein the second initial logic description information is information used to describe an execution logic of the program code; adding a second memory identifier to the second initial logic description information to obtain second target logic description information, wherein the second memory identifier is used to indicate a memory object to which the second initial logic description information is stored.

14. A verification method of program code, comprising: obtaining program code to be verified and associated program code of the program code by calling a first interface, wherein the program code is used to call an execution result of the associated program code in an execution process, the first interface includes a first parameter, and a parameter value of the first parameter is the program code and the associated program code; analyzing the associated program code to obtain first initial logic description information, wherein the first initial logic description information is information used to describe an execution logic of the associated program code, and the associated program code is used to execute according to the execution logic to obtain the execution result; adding a first memory identifier to the first initial logic description information to obtain first target logic description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logic description information is stored; verifying the program code based on the first target logic description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code; and returning the verification result to the domain name system. The verification result is output by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter is the verification result.

15. A verification system of program code, comprising: a client configured to upload program code to be verified and associated program code of the program code, wherein the program code is used to call an execution result of the associated program code in an execution process; a server configured to analyze the associated program code to obtain first initial logical description information, wherein the first initial logical description information is information used to describe an execution logic of the associated program code, the associated program code is used to execute according to the execution logic to obtain the execution result, add a first memory identifier to the first initial logical description information to obtain first target logical description information, wherein the first memory identifier is used to indicate a target memory object to which the first initial logical description information is stored, verify the program code based on the first target logical description information to obtain a verification result, wherein the verification result is used to indicate correctness of the program code, and issue the verification result to the client.

16. An electronic device, comprising: a memory storing an executable program; a processor configured to run the program, wherein the program runs to execute the method of any one of claims 1 to 14.

17. A computer readable storage medium comprising a stored executable program, wherein, controlling a device in which the storage medium is located to execute the method of any one of claims 1 to 14 when the executable program runs.

18. A computer program product, comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 14.

19. A computer program product, comprising a non-volatile computer readable storage medium storing a computer program which, when executed by a processor, implements the method of any one of claims 1 to 14.

Citation Information

Patent Citations

  • Static code check method and apparatus, storage medium and computer device

    CN108614707A

  • Code inspection method and device, computer equipment and computer readable storage medium

    CN112052008A

  • Formalized verification method and system

    CN115687166A

  • Cross-validation based code feature tagging

    US20170097823A1