CN111104121A - Detection method, device, equipment and storage medium - Google Patents

Detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN111104121A
CN111104121A CN201911326418.0A CN201911326418A CN111104121A CN 111104121 A CN111104121 A CN 111104121A CN 201911326418 A CN201911326418 A CN 201911326418A CN 111104121 A CN111104121 A CN 111104121A
Authority
CN
China
Prior art keywords
instruction
detected
execution path
target
target object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911326418.0A
Other languages
Chinese (zh)
Other versions
CN111104121B (en
Inventor
杨志谦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201911326418.0A priority Critical patent/CN111104121B/en
Publication of CN111104121A publication Critical patent/CN111104121A/en
Application granted granted Critical
Publication of CN111104121B publication Critical patent/CN111104121B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis

Abstract

The application relates to a detection method, a detection device, a detection equipment and a storage medium. The method comprises the following steps: determining an instruction to be detected; acquiring at least one target execution path corresponding to the instruction to be detected; determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object; judging whether a closing operation meeting a preset rule aiming at a target object exists in an operation instruction set included in a target execution path; and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result. Therefore, the detection effect is improved, and the accuracy of the detection result is improved.

Description

Detection method, device, equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a detection method, apparatus, device, and storage medium.
Background
The project has a large amount of objects such as operation resources, files, stream data and the like, the objects are opened in the project development process, corresponding objects are closed after the operation is finished, and in java, the objects are often the implementation classes of the Closeable interface and are called Closeable objects. However, in the actual development process, the developer may forget to close the operation, or may not consider the extreme case, so that even after exiting the use, the close operation code of the Closeable object is not executed, and thus, the resource is not released (such as a file stream), causing the resource to leak, or causing the program to enter another abnormal state.
Currently, to solve the above problems, a hook is usually performed on a runtime environment during program running, and after detecting that an open operation is executed, a timing check is performed to determine whether a close operation exists, and if not, a problem report is performed. The existing detection process needs manual testing, and the test cases are difficult to cover all scenes; the detection process is performed during the operation, and the timing of checking whether or not the closing operation is performed is not well controlled, and the checking process is delayed.
Disclosure of Invention
In order to solve the above problems, the present invention provides a detection method, apparatus, device, and storage medium, which can determine a control operation for a target object from an instruction perspective to determine whether there is a shutdown operation for the target object that satisfies a preset rule, and the detection process is performed during program compilation without manual testing or consideration of detection time, so that detection efficiency and accuracy of a detection result can be improved without setting a test case.
In a first aspect, an embodiment of the present application provides a detection method, including:
determining an instruction to be detected;
acquiring at least one target execution path corresponding to the instruction to be detected;
determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object;
judging whether a closing operation meeting a preset rule aiming at a target object exists in an operation instruction set included in a target execution path;
and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
The detection method and the detection device have the advantages that the scheme is used for detecting the instruction to be detected and the target execution path required to be operated by the instruction to be detected, so that the detection process can cover all scenes to the maximum extent, and the detection process does not need to be provided with a test case, so that compared with the existing detection mode through the test case, the detection method and the detection device do not need manual testing, the detection efficiency is improved, and meanwhile, a foundation is laid for improving the accuracy of a detection result.
Moreover, because the scheme of the application is carried out aiming at the target execution path of the instruction to be detected, the detection process can be carried out during the program compiling period without being carried out under the running environment, so that the problem of detection lag of the existing detection mode is solved, meanwhile, the detection process can be carried out during the compiling period, so that the foundation is laid for rapidly solving the problem, improving the program stability, and further laying the foundation for avoiding code resource leakage caused by the problem that the detection lag is not solved in time.
In a specific embodiment, the determining whether a closing operation meeting a preset rule exists for a target object in an operation instruction set included in a target execution path includes:
and judging whether a closing operation which corresponds to the opening operation and meets a preset rule exists after the opening operation aiming at the target object exists in an operation instruction set contained in the target execution path.
The method and the device have the advantages that the detection efficiency is improved to the maximum extent, the operation steps after the starting operation for the target object are detected in the detection process of the target execution path, the foundation is laid for improving the detection efficiency to the maximum extent, meanwhile, the foundation is laid for rapidly solving the problem and improving the program stability, and the foundation is laid for avoiding code resource leakage caused by the fact that the problem is not solved in time due to detection lag.
In a specific embodiment, the method further comprises:
determining at least one function in the program to be detected;
acquiring an instruction corresponding to at least one function;
and taking at least part of instructions corresponding to at least one function as instructions to be detected.
In order to meet the actual requirements, expand the application range and enrich the application scenes, the application scheme can be expanded into instructions corresponding to functions in the detection program, and further the application scheme can be applied to development scenes, such as program development, so that the application program is enriched, a foundation is laid for improving the development efficiency, and a foundation is laid for engineering application.
In a specific embodiment, the taking at least a part of the instructions corresponding to the at least one function as the instructions to be detected includes:
and judging whether the instruction corresponding to the function comprises a control operation aiming at the target object, if so, taking the instruction comprising the control operation aiming at the target object as a to-be-detected instruction.
In a specific embodiment, the method further comprises:
setting a preset operation instruction type;
and taking an instruction matched with a preset operation instruction type in the instructions corresponding to the function as an instruction to be detected, so that the instruction to be detected comprises control operation aiming at the target object.
In the scheme, for fitting an actual scene, the detection efficiency problem under the specific scene is further improved, the operation instruction type can be preset, namely the operation instruction type is preset, and then the instruction matched with the preset operation instruction type is detected, so that the detection efficiency under the specific scene is improved, and a foundation is laid for engineering application.
In a specific embodiment, the obtaining at least one target execution path corresponding to the instruction to be detected includes:
taking an execution path required to be operated by an instruction to be detected as a target execution path corresponding to the instruction to be detected; and the number of the first and second groups,
and taking an execution path to which the instruction to be detected jumps based on the jump instruction in the running process as a target execution path corresponding to the instruction to be detected.
The method and the device solve the problem of detection efficiency under a specific scene to the maximum extent, and cover all practical scenes to the maximum extent, the scheme of the application not only takes the execution path required to be operated by the instruction to be detected as the target execution path, but also takes the execution path jumped to by the instruction to be detected based on the jump instruction in the operation process as the target execution path, and further detects all target execution paths, so that all practical scenes are covered to the maximum extent, a foundation is laid for improving the detection efficiency to the maximum extent, a foundation is laid for solving the problem quickly and improving the program stability, and a foundation is laid for avoiding code resource leakage caused by the problem that detection lags and is not solved in time.
In a second aspect, an embodiment of the present application provides a detection apparatus, including:
the first processing unit is used for determining the instruction to be detected; acquiring at least one target execution path corresponding to the instruction to be detected; determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object;
the second processing unit is used for judging whether a closing operation meeting a preset rule for the target object exists in an operation instruction set included in the target execution path; and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
In a specific embodiment, the second processing unit is further configured to determine whether a closing operation corresponding to the opening operation and meeting a preset rule exists after the opening operation for the target object exists in an operation instruction set included in the target execution path.
In an embodiment, the first processing unit is further configured to:
determining at least one function in the program to be detected;
acquiring an instruction corresponding to at least one function;
and taking at least part of instructions corresponding to at least one function as instructions to be detected.
In an embodiment, the first processing unit is further configured to: and judging whether the instruction corresponding to the function comprises a control operation aiming at the target object, if so, taking the instruction comprising the control operation aiming at the target object as a to-be-detected instruction.
In an embodiment, the first processing unit is further configured to: setting a preset operation instruction type;
and taking an instruction matched with a preset operation instruction type in the instructions corresponding to the function as an instruction to be detected, so that the instruction to be detected comprises control operation aiming at the target object.
In an embodiment, the first processing unit is further configured to:
taking an execution path required to be operated by an instruction to be detected as a target execution path corresponding to the instruction to be detected; and the number of the first and second groups,
and taking an execution path to which the instruction to be detected jumps based on the jump instruction in the running process as a target execution path corresponding to the instruction to be detected.
In a third aspect, an embodiment of the present application provides a detection apparatus, including:
one or more processors;
a memory communicatively coupled to the one or more processors;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the methods described above.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method described above.
Therefore, the scheme of the application detects the instruction to be detected and the target execution path required to be operated by the instruction to be detected, so that the detection flow can be guaranteed to cover all scenes to the maximum extent, and the detection flow does not need to be provided with a test case.
Moreover, because the scheme of the application is carried out aiming at the target execution path of the instruction to be detected, the detection process can be carried out during the program compiling period without being carried out under the running environment, so that the problem of detection lag of the existing detection mode is solved, meanwhile, the detection process can be carried out during the compiling period, so that the foundation is laid for rapidly solving the problem, improving the program stability, and further laying the foundation for avoiding code resource leakage caused by the problem that the detection lag is not solved in time.
Drawings
FIG. 1 is a schematic diagram of a flow chart of a detection method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a specific application scenario of the detection method according to the embodiment of the present application;
FIG. 3 is a schematic structural diagram of a detecting device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a detection apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In some of the flows described in the specification and claims of the present application and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that the flows may include more or less operations, and that the operations may be performed sequentially or in parallel.
For the problem in the prior art, in the present application, during the compiling period, the instruction (i.e., the instruction to be detected) in all the methods (i.e., the functions in the present application) is scanned, and all the possible execution paths (e.g., the target execution path in the present application) corresponding to the instruction are traversed, so as to find whether an exception handling process exists, that is, whether a situation that a clear object is not closed exists is found, and a report is generated accordingly, so as to solve the problem in time.
Specifically, fig. 1 is a schematic flow chart of an implementation of the detection method according to the embodiment of the present invention, and as shown in fig. 1, the method includes:
step 101: and determining the instruction to be detected.
Here, in order to enrich the application scenario of the scheme of the present application, the instruction to be detected may specifically be an instruction corresponding to a function in the program to be detected, so as to implement a detection process of the program to be detected, and specifically, determine at least one function in the program to be detected; acquiring an instruction corresponding to at least one function; and taking at least part of instructions corresponding to at least one function as instructions to be detected. For example, in a specific scenario, to detect all scenarios of a program to be detected, all functions of the program to be detected are obtained, all instructions corresponding to all functions are obtained, and then all instructions corresponding to all functions are used as instructions to be detected, or, in order to improve detection efficiency, only instructions of a part of instructions (for example, instructions that satisfy some rules) in all instructions corresponding to all functions may be used as instructions to be detected. Here, it should be noted that the rule of instruction filtering may be set according to the actual scene requirement in the development environment, and the embodiment of the present application does not limit this.
In a specific example, the instruction to be detected may be selected by using the following filtering rule, specifically, it is determined whether the instruction corresponding to the function includes the control operation for the target object, and if so, the instruction including the control operation for the target object is used as the instruction to be detected. That is, in an example, an instruction of a control operation for a target object may be included in all instructions corresponding to all functions in a program to be detected as an instruction to be detected.
In another specific example, the instruction to be detected may also be determined in the following manner, specifically, a preset operation instruction type is set; and taking an instruction matched with a preset operation instruction type in the instructions corresponding to the function as an instruction to be detected, so that the instruction to be detected comprises control operation aiming at the target object. Here, in order to fit an actual scene and further improve the detection efficiency problem in a specific scene, the present example presets an operation instruction type, that is, a preset operation instruction type, which can represent an operation type for operation control of a target object, and then detects an instruction matched with the preset operation instruction type, so that the detection efficiency in the specific scene is improved, and a foundation is laid for engineering application.
Here, it should be noted that in an actual scenario, the number of preset operation instruction types may be set according to actual requirements, for example, 1 or 7, and the like, and this is not limited in the embodiment of the present application.
Here, in practical applications, the target object may be specifically a Closeable object, and of course, may also be another object, which is not limited in this embodiment of the present application.
Step 102: and acquiring at least one target execution path corresponding to the instruction to be detected.
In practical application, because other instructions may be called in the operation process of the instruction, so that the execution path where the instruction operates jumps, that is, one instruction may correspond to one execution path and may also correspond to more than one execution path, for this situation, in order to cover all scenarios to the maximum extent, the target execution path in the present application scheme also includes the execution path after jumping, that is, includes all execution paths involved in the operation of the instruction to be detected, and specifically, the execution path where the instruction to be detected needs to operate is taken as the target execution path corresponding to the instruction to be detected; and taking an execution path to which the instruction to be detected jumps based on the jump instruction in the running process as a target execution path corresponding to the instruction to be detected. Therefore, the accuracy of the detection result is improved to the maximum extent.
Step 103: and determining an operation instruction set aiming at the target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object.
For example, in an example, in order to detect whether a closing operation for the Closeable object exists in the target execution path executed by the instruction to be detected, all control operations for the Closeable object in the target execution path need to be acquired, and then whether the closing operation for the Closeable object that satisfies the rule is executed is determined based on the acquired control operations.
Step 104: and judging whether a closing operation meeting a preset rule exists in an operation instruction set included in the target execution path or not.
Here, to maximize the detection efficiency, in the detection process of the target execution path, an operation step after the opening operation on the target object may be detected, and specifically, it is determined whether a closing operation corresponding to the opening operation and meeting a preset rule exists after the opening operation on the target object exists in the operation instruction set included in the target execution path. For example, in order to detect whether a closing operation for the Closeable object exists in a target execution path in which the instruction to be detected runs, all control operations (i.e., an operation instruction set) for the Closeable object in the target execution path need to be acquired, and after detecting that a specific control operation in the operation instruction set is an opening operation for the target object, it is further detected whether a closing operation corresponding to the opening operation and meeting a preset rule exists, so that the detection efficiency is improved.
Here, because the actual scenes are different and the business requirements are also different, the closing operation modes can be different in different scenes, and therefore the closing operation meeting the scene requirements (namely, the preset rule) can be set aiming at the scenes, so that the applicability of the scheme of the application is improved, and further a foundation is laid for the subsequent engineering application.
Step 105: and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
Here, when the judgment result indicates that the operation instruction set included in the target execution path has a closing operation meeting the preset rule for the target object, or when the judgment result indicates that the operation instruction set included in the target execution path has an opening operation for the target object, and then has a closing operation meeting the preset rule corresponding to the opening operation, it may be determined that the processing flow of the instruction to be detected is in compliance, otherwise, it may be determined that the processing flow of the instruction to be detected is not in compliance, and an out-of-compliance result is output, so that the research and development staff may modify in time.
Therefore, the scheme of the application detects the instruction to be detected and the target execution path required to be operated by the instruction to be detected, so that the detection flow can be guaranteed to cover all scenes to the maximum extent, and the detection flow does not need to be provided with a test case.
Moreover, because the scheme of the application is carried out aiming at the target execution path of the instruction to be detected, the detection process can be carried out during the program compiling period without being carried out under the running environment, so that the problem of detection lag of the existing detection mode is solved, meanwhile, the detection process can be carried out during the compiling period, so that the foundation is laid for rapidly solving the problem, improving the program stability, and further laying the foundation for avoiding code resource leakage caused by the problem that the detection lag is not solved in time.
The following further details the embodiments of the present invention with reference to specific application scenarios, and the specific steps are shown in fig. 2 and include:
step 201: all instructions in the method (i.e. function) of the program to be detected are determined. For example, a methodview callback is read, where each method corresponds to one methodview, and thus, all instructions corresponding to the method are obtained by using the methodview.
Step 202: it is determined whether there is an operation for the Closeable object in all instructions. Here, if the operation of the Closeable object does not exist in the instruction, the scanning can be terminated quickly, and thus, the scanning speed is increased.
In practical application, in order to improve the detection efficiency, a flag type (that is, a preset operation instruction type) may be preset, all instructions of the method are traversed, and each instruction is marked to screen out a target instruction matched with the preset flag type.
Here, in practical applications, the mark type may be specifically the following types:
return CloseableType (characterizes call back Closeable object); NewType (characterizes the creation of Closeable objects); NullType (a Null judge instruction is characterized and can be used for filtering a judge Null path aiming at a Closeable object); NotNullType (a NotNull decision instruction is characterized for filtering a decision null path for Closeable); ParameterType (parameter passing characterizing Closeable objects); ExceptionType (characterizing normal method calls, but with exception identification); return type (characterizes the Closeable object as a return value).
Step 203: analyzing the execution paths of all target instructions, for example, reading callbacks for all target instructions by using the FlowAnalyzer of Asm, and analyzing all the execution paths of the target instructions.
Specifically, all instructions executed in each execution path corresponding to the target instruction are analyzed, for example, the target instruction is return closeable type or NewType, and the operation record is an open operation, at this time, if the position is recorded as an open operation, it is determined that no close operation is performed (because there is no close in the loop body); for target instructions of NullType and NotNullType, discarding operation is carried out, and the Closeable object is empty and does not need to be closed; for the target instruction being CloseType, a close operation is assumed to be present; for the target instruction of ParameterType or ReturnType, judging whether closing operation exists according to business logic requirements according to conditions, and removing corresponding opening operation when closing operation so as to represent normal closing; and if the target instruction is the ExceptionType, judging whether the corresponding catch code exists and can be caught or not, if the target instruction is not the ExceptionType, considering the target instruction as abnormal exit, and determining that the closing operation is not performed.
Step 204: and outputting the analysis result to a result directory, and finishing the analysis so as to be convenient for modification based on the analysis result.
In this way, by analyzing all possibilities for operating on the Closeable object, possible unclosed execution paths are discovered, thereby facilitating the discovery of potential code resource leakage issues during compilation.
An embodiment of the present application further provides a detection apparatus, as shown in fig. 3, the apparatus includes:
the first processing unit 31 is used for determining the instruction to be detected; acquiring at least one target execution path corresponding to the instruction to be detected; determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object;
the second processing unit 32 is configured to determine whether a closing operation meeting a preset rule exists for the target object in an operation instruction set included in the target execution path; and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
In a specific embodiment, the second processing unit 32 is further configured to determine whether a closing operation corresponding to the opening operation and meeting a preset rule exists after the opening operation for the target object exists in the operation instruction set included in the target execution path.
In an embodiment, the first processing unit 31 is further configured to:
determining at least one function in the program to be detected;
acquiring an instruction corresponding to at least one function;
and taking at least part of instructions corresponding to at least one function as instructions to be detected.
In an embodiment, the first processing unit 31 is further configured to: and judging whether the instruction corresponding to the function comprises a control operation aiming at the target object, if so, taking the instruction comprising the control operation aiming at the target object as a to-be-detected instruction.
In an embodiment, the first processing unit 31 is further configured to: setting a preset operation instruction type;
and taking an instruction matched with a preset operation instruction type in the instructions corresponding to the function as an instruction to be detected, so that the instruction to be detected comprises control operation aiming at the target object.
In an embodiment, the first processing unit 31 is further configured to:
taking an execution path required to be operated by an instruction to be detected as a target execution path corresponding to the instruction to be detected; and the number of the first and second groups,
and taking an execution path to which the instruction to be detected jumps based on the jump instruction in the running process as a target execution path corresponding to the instruction to be detected.
Here, it should be noted that: the descriptions of the embodiments of the apparatus are similar to the descriptions of the methods, and have the same advantages as the embodiments of the methods, and therefore are not repeated herein. For technical details that are not disclosed in the embodiments of the apparatus of the present invention, those skilled in the art should refer to the description of the embodiments of the method of the present invention to understand, and for brevity, will not be described again here.
An embodiment of the present application further provides a detection device, including: one or more processors; a memory communicatively coupled to the one or more processors; one or more application programs; wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method described above.
In a specific example, the detection device according to the embodiment of the present application may be embodied as a structure as shown in fig. 4, and the detection device at least includes a processor 41, a storage medium 42, and at least one external communication interface 43; the processor 41, the storage medium 42, and the external communication interface 43 are all connected by a bus 44. The processor 41 may be a microprocessor, a central processing unit, a digital signal processor, or a programmable logic array, etc. electronic components with processing functions. The storage medium has stored therein computer executable code capable of performing the method of any of the above embodiments. In practical applications, the first processing unit 31 and the second processing unit 32 can be implemented by the processor 41.
Here, it should be noted that: the above description of the embodiment of the detection device is similar to the above description of the method, and has the same beneficial effects as the embodiment of the method, and therefore, the description thereof is omitted. For technical details that are not disclosed in the embodiments of the detection apparatus of the present invention, those skilled in the art should refer to the description of the embodiments of the method of the present invention to understand that, for the sake of brevity, detailed description is omitted here.
Embodiments of the present application also provide a computer-readable storage medium, which stores a computer program, and when the program is executed by a processor, the computer program implements the method described above.
A computer-readable storage medium can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM). Further, the computer-readable storage medium may even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that all or part of the steps carried by the method for implementing the above embodiments can be implemented by hardware related to instructions of a program, which can be stored in a computer readable storage medium, and the program includes one or a combination of the steps of the method embodiments when the program is executed.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer readable storage medium. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
The embodiments described above are only a part of the embodiments of the present invention, and not all of them. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Claims (10)

1. A method of detection, the method comprising:
determining an instruction to be detected;
acquiring at least one target execution path corresponding to the instruction to be detected;
determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object;
judging whether a closing operation meeting a preset rule aiming at a target object exists in an operation instruction set included in a target execution path;
and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
2. The method according to claim 1, wherein the determining whether a closing operation meeting a preset rule exists for the target object in an operation instruction set included in the target execution path includes:
and judging whether a closing operation which corresponds to the opening operation and meets a preset rule exists after the opening operation aiming at the target object exists in an operation instruction set contained in the target execution path.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
determining at least one function in the program to be detected;
acquiring an instruction corresponding to at least one function;
and taking at least part of instructions corresponding to at least one function as instructions to be detected.
4. The method according to claim 3, wherein the taking at least a part of the instructions corresponding to the at least one function as the instructions to be detected comprises:
and judging whether the instruction corresponding to the function comprises a control operation aiming at the target object, if so, taking the instruction comprising the control operation aiming at the target object as a to-be-detected instruction.
5. The method of claim 3, further comprising:
setting a preset operation instruction type;
and taking an instruction matched with a preset operation instruction type in the instructions corresponding to the function as an instruction to be detected, so that the instruction to be detected comprises control operation aiming at the target object.
6. The method according to claim 1, wherein the obtaining at least one target execution path corresponding to the instruction to be detected comprises:
taking an execution path required to be operated by an instruction to be detected as a target execution path corresponding to the instruction to be detected; and the number of the first and second groups,
and taking an execution path to which the instruction to be detected jumps based on the jump instruction in the running process as a target execution path corresponding to the instruction to be detected.
7. A detection device, the device comprising:
the first processing unit is used for determining the instruction to be detected; acquiring at least one target execution path corresponding to the instruction to be detected; determining an operation instruction set aiming at a target object, which is contained in a target execution path corresponding to the instruction to be detected, wherein the operation instruction set contains at least one control operation aiming at the target object;
the second processing unit is used for judging whether a closing operation meeting a preset rule for the target object exists in an operation instruction set included in the target execution path; and determining whether the processing flow of the instruction to be detected is in compliance based on the judgment result.
8. The apparatus according to claim 7, wherein the second processing unit is further configured to determine whether a close operation corresponding to the open operation and satisfying a preset rule exists after the open operation for the target object exists in the operation instruction set included in the target execution path.
9. A detection apparatus, comprising:
one or more processors;
a memory communicatively coupled to the one or more processors;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-6.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
CN201911326418.0A 2019-12-20 2019-12-20 Detection method, detection device, detection equipment and storage medium Active CN111104121B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911326418.0A CN111104121B (en) 2019-12-20 2019-12-20 Detection method, detection device, detection equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911326418.0A CN111104121B (en) 2019-12-20 2019-12-20 Detection method, detection device, detection equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111104121A true CN111104121A (en) 2020-05-05
CN111104121B CN111104121B (en) 2023-05-16

Family

ID=70422645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911326418.0A Active CN111104121B (en) 2019-12-20 2019-12-20 Detection method, detection device, detection equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111104121B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1247374A (en) * 1998-09-05 2000-03-15 K·A·施莫沙尔公司 Non-contact safety switch
US20050066319A1 (en) * 2003-09-22 2005-03-24 Deline Robert Anthony Persisted specifications of method pre-and post-conditions for static checking
US20130298105A1 (en) * 2012-05-01 2013-11-07 Oracle International Corporation Indicators for resources with close methods that do not complete erroneously in software programs
JP2016151855A (en) * 2015-02-17 2016-08-22 日本電信電話株式会社 Program analyzer, error detector, program analyzing method, error detection method, program analyzing program and error detection program
CN108021445A (en) * 2017-11-22 2018-05-11 广州品唯软件有限公司 Memory Optimize Method, device, system and computer-readable recording medium
CN109656917A (en) * 2018-12-18 2019-04-19 深圳前海微众银行股份有限公司 Data detection method, device, equipment and the readable storage medium storing program for executing of multi-data source
CN109710425A (en) * 2018-12-19 2019-05-03 北京金山安全软件有限公司 Message monitoring method and device
CN109783231A (en) * 2018-12-18 2019-05-21 珠海市网欣软件开发有限公司 Check whether non-managed resource has the method for being released processing in program code

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1247374A (en) * 1998-09-05 2000-03-15 K·A·施莫沙尔公司 Non-contact safety switch
US20050066319A1 (en) * 2003-09-22 2005-03-24 Deline Robert Anthony Persisted specifications of method pre-and post-conditions for static checking
US20130298105A1 (en) * 2012-05-01 2013-11-07 Oracle International Corporation Indicators for resources with close methods that do not complete erroneously in software programs
JP2016151855A (en) * 2015-02-17 2016-08-22 日本電信電話株式会社 Program analyzer, error detector, program analyzing method, error detection method, program analyzing program and error detection program
CN108021445A (en) * 2017-11-22 2018-05-11 广州品唯软件有限公司 Memory Optimize Method, device, system and computer-readable recording medium
CN109656917A (en) * 2018-12-18 2019-04-19 深圳前海微众银行股份有限公司 Data detection method, device, equipment and the readable storage medium storing program for executing of multi-data source
CN109783231A (en) * 2018-12-18 2019-05-21 珠海市网欣软件开发有限公司 Check whether non-managed resource has the method for being released processing in program code
CN109710425A (en) * 2018-12-19 2019-05-03 北京金山安全软件有限公司 Message monitoring method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
王志刚;李曦;周学海;余洁;: "可重定向的定制指令集处理器(ASIP)仿真技术研究", 系统仿真学报 *
边攀等: "一种基于CIL静态分析的C#程序缺陷检测方法", 《计算机科学》 *
黄蔚;洪玫;杨秋辉;郭鑫宇;代声馨;徐保平;高婉玲;赵鹤;: "基于有界模型检测的C/C++程序内存泄露检测", 计算机应用研究 *

Also Published As

Publication number Publication date
CN111104121B (en) 2023-05-16

Similar Documents

Publication Publication Date Title
US20190324772A1 (en) Method and device for processing smart contracts
US10210076B2 (en) White box testing
KR100926115B1 (en) Apparatus and method for automatically analyzing a program for detecting malicious codes triggered under an certain event/context
US10223080B2 (en) Method and system for automated, static instrumentation for applications designed for execution in environments with restricted resources
CN107145437B (en) Java annotation test method and device
US20100023926A1 (en) Call graph dependency extraction by static source code analysis
JP2022505340A (en) Systems and methods for dynamically identifying data arguments and instrumenting source code
CN109101815B (en) Malicious software detection method and related equipment
CN110363004B (en) Code vulnerability detection method, device, medium and equipment
KR101900047B1 (en) Method and Apparatus to Evaluate Required Permissions for Application
CN104252592A (en) Method and device for identifying plug-in application program
CN108984416B (en) Method for evaluating dependency conflict danger level in Maven environment
CN112732587A (en) Method and device for acquiring automatic test log, electronic equipment and storage medium
CN111176722A (en) Method and device for detecting file version of third-party library and storage medium
CN111124870A (en) Interface testing method and device
CN114756284A (en) Method and device for realizing stack backtracking of variable-length instruction set system
CN106933642B (en) Application program processing method and processing device
CN109960656B (en) Program detection method and device and electronic equipment
CN110889116B (en) Advertisement interception method and device and electronic equipment
CN111104121A (en) Detection method, device, equipment and storage medium
CN114328168A (en) Anomaly detection method and device, computer equipment and storage medium
CN112632547A (en) Data processing method and related device
CN111027072A (en) Kernel Rootkit detection method and device based on elf binary system standard analysis under Linux
CN116401670A (en) Vulnerability patch existence detection method and system in passive code scene
CN106528179B (en) A kind of static recognition methods of java class dependence

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant