CN112181761B - Program execution control method, program execution test device, code detection device, program execution equipment and medium - Google Patents

Program execution control method, program execution test device, code detection device, program execution equipment and medium Download PDF

Info

Publication number
CN112181761B
CN112181761B CN202010995468.4A CN202010995468A CN112181761B CN 112181761 B CN112181761 B CN 112181761B CN 202010995468 A CN202010995468 A CN 202010995468A CN 112181761 B CN112181761 B CN 112181761B
Authority
CN
China
Prior art keywords
native monitoring
monitoring method
target
calling
application program
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.)
Active
Application number
CN202010995468.4A
Other languages
Chinese (zh)
Other versions
CN112181761A (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.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya 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 Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202010995468.4A priority Critical patent/CN112181761B/en
Publication of CN112181761A publication Critical patent/CN112181761A/en
Application granted granted Critical
Publication of CN112181761B publication Critical patent/CN112181761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a medium for program execution control, test and code detection. The execution control method of the application program comprises the following steps: in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method; in the application program, each native monitoring method is packaged in the matched safe calling method; and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method. The technical scheme of the embodiment of the invention makes up the defect that the application program is easy to crash when the calling is abnormal or the service data is abnormal in the conventional calling method mode, and realizes the effect of improving the stability of the application program.

Description

Program execution control method, program execution test device, code detection device, program execution equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a method, a device, equipment and a medium for program execution control, test and code detection.
Background
With the continuous development of the mobile internet, various mobile phone end application programs emerge from the market, and various service requirements of people in daily life are met.
In the prior art, various data objects (such as a set or an array) are frequently called during the execution of an application program, or a set function method is frequently called.
The inventor discovers that in the process of implementing the invention: in the calling process, due to the fact that a developer uses an improper interface, or due to the fact that abnormal data is returned by a server side, and an abnormal error is easy to occur in an application program, the application program is crashed, and then great loss can be caused in a short time.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device, and a medium for program execution control, test, and code detection, which can reduce the collapse probability of an application program and improve the stability of the application program.
In a first aspect, an embodiment of the present invention provides an execution control method for an application program, including:
in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method.
In a second aspect, an embodiment of the present invention further provides a method for testing an application program, where the method includes:
in the test execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method and outputting the abnormal alarm information.
In a third aspect, an embodiment of the present invention further provides a method for detecting a program code, where the method includes:
acquiring a code to be submitted, and identifying a native monitoring method in the code to be submitted;
and if the first target native monitoring method in the code to be submitted is detected not to be encapsulated in the matched safe calling method, stopping submitting the code to be submitted to an online code platform, and generating alarm information matched with the first target native monitoring method.
In a fourth aspect, an embodiment of the present invention further provides an apparatus for controlling execution of an application program, including:
the first method pre-execution module is used for pre-executing the target native monitoring method in a target safe calling method matched with the target native monitoring method if the calling of the target native monitoring method is detected in the normal execution process of the application program;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and the first exception handling method execution module is used for skipping to execute the exception handling method in the target safe calling method if the pre-execution result of the target native monitoring method is abnormal.
In a fifth aspect, an embodiment of the present invention further provides an apparatus for testing an application program, including:
the second method pre-execution module is used for pre-executing the target native monitoring method in a target safe calling method matched with the target native monitoring method if the calling of the target native monitoring method is detected in the test execution process of the application program;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and the second exception handling method execution module is used for skipping to execute an exception handling method in the target safe calling method and outputting the abnormal alarm information if the pre-execution result of the target native monitoring method is abnormal.
In a sixth aspect, an embodiment of the present invention further provides a device for detecting a program code, where the device includes:
the native monitoring method identification module is used for acquiring a code to be submitted and identifying a native monitoring method in the code to be submitted;
and the warning information generation module is used for preventing the code to be submitted from being submitted to an online code platform and generating warning information matched with the first target native monitoring method if the fact that the first target native monitoring method in the code to be submitted is not packaged in the matched security calling method is detected.
In a seventh aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the execution control method of the application program provided by any embodiment of the present invention, or implement the test method of the application program provided by any embodiment of the present invention, or implement the detection method of the program code provided by any embodiment of the present invention.
In an eighth aspect, an embodiment of the present invention further provides a storage medium containing computer-executable instructions, where the computer-executable instructions, when executed by a computer processor, are configured to perform an execution control method of an application program according to any embodiment of the present invention, or implement a test method of the application program according to any embodiment of the present invention, or implement a detection method of a program code according to any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, the native monitoring method is encapsulated inside the matched safe calling method, when the native monitoring method is called, the native monitoring method is pre-executed firstly, and when the pre-execution result is abnormal, the abnormal processing method in the safe calling method is skipped to execute. The problem that the application program is easy to crash when calling is abnormal or service data is abnormal in a method calling mode in the prior art is solved, the crash probability of the application program is reduced to the maximum extent, and the stability of the application program is improved.
Drawings
Fig. 1 is a flowchart of an execution control method of an application program according to a first embodiment of the present invention;
fig. 2 is a flowchart of an execution control method of an application program according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a method for testing an application according to a third embodiment of the present invention;
FIG. 4 is a flowchart of a method for detecting program codes according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an application execution control apparatus according to a fifth embodiment of the present invention;
FIG. 6 is a schematic structural diagram of an apparatus for testing an application according to a sixth embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an apparatus for detecting program codes according to a seventh embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device in an eighth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, subprograms, and the like.
Example one
Fig. 1 is a flowchart of an execution control method of an application according to a first embodiment of the present invention, where the embodiment is applicable to a case where a native monitoring method is called during a normal execution process of the application, and the method may be executed by an execution control apparatus of the application, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in a mobile terminal device (e.g., a mobile phone or a tablet computer, etc.) where the application is installed. As shown in fig. 1, the method includes:
s110, in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method.
In the application program, each native monitoring method is packaged in the matched safe calling method.
The application program is a program which needs to call a native monitoring method in the normal execution process, and the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk. The safe calling method is generated by packaging the original monitoring method, and is matched with the original monitoring method.
The normal execution process of the application program refers to a stage of downloading, installing and using the application program by a common user after the application program is operated online.
In the embodiment of the invention, when the application program is normally executed, the calling of the native monitoring method may have abnormal risks, which may cause the application program to crash, therefore, the native monitoring method is packaged into the safe calling method, and when the native monitoring method needs to be called, the native monitoring method is pre-executed in the safe calling method.
In an optional embodiment of the present invention, the method for native monitoring may comprise: calling method for data object with set type and/or character conversion method; the data objects may include: an array, and/or a collection.
Optionally, taking an application running on an Android operating system as an example, a developer may establish a matched security library (Safe class) for a Set, an array and a character conversion method used in the Android operating system, for example, may establish a Safe library class SafeList corresponding to the List, a Safe library class SafeSet corresponding to the Set, and a Safe library class SafeMap corresponding to the Map. The List, set, and Map are all interfaces used in the Set.
Correspondingly, the method corresponding to each data object encapsulates the safe calling method, and typically, the hook technology is adopted to encapsulate the original set, array and character conversion method, so that all the calls of the calling set, array and character conversion method are circulated through the safe calling method.
In the embodiment of the invention, when the array or the set is called or the character conversion is carried out, calling abnormity or service data abnormity is easy to occur, so that the calling method of the array or the set and the character conversion method are required to be packaged into the corresponding safe calling method, thereby reducing the risk of closing the application program caused by the abnormal condition, namely reducing the collapse probability of the application program.
S120, if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method.
The pre-execution result is an execution result corresponding to the execution of the target native monitoring method in the secure calling method, and the pre-execution result may be a successful execution or an abnormal execution. The exception handling method is packaged in the safety calling method and used for intercepting exceptions or handling exception data when the native monitoring method is executed in advance and the exceptions occur.
When the pre-execution result is successful, the target secure calling method can output the pre-execution result to the outside of the target secure calling method so as to transfer to the next execution process of the application program; if the result of the execution is the execution exception, the target secure calling method locks the result of the exception execution in the self method, and does not output the result outwards, but continues to call the execution exception handling method in the target secure calling method, and further, the result of the exception handling method can be output outwards of the target secure calling method, so as to avoid the application program crash caused by outputting the result of the exception execution.
That is, in the technical solution of the embodiment of the present invention, the native monitoring method which is easy to generate execution exception is encapsulated in the secure calling method, and the native monitoring method is controlled to be executed in the secure calling method, and meanwhile, after the execution exception occurs in the native monitoring method, an exception handling mechanism can be called to perform exception handling, so as to prevent an exception handling result from being exposed to the outside, and reduce the crash probability of the application program by the maximum program.
In the embodiment of the invention, the native monitoring method and the exception handling method are packaged in the safe calling method, when the calling of the native monitoring method is detected, the native monitoring method is pre-executed in the safe calling method, and when the native monitoring method is pre-executed abnormally, the exception handling method is executed, so that the influence of the calling abnormality of the native monitoring method on the application program is reduced, the probability of the application program crash is reduced, and the stability of the application program is improved.
According to the technical scheme of the embodiment of the invention, the native monitoring method is packaged in the matched safe calling method, when the native monitoring method is called in the normal execution process of the application program, the native monitoring method is pre-executed, and when the pre-execution result is abnormal, the abnormal processing method in the safe calling method is skipped to be executed. The problem that the application program is easy to crash when calling is abnormal or service data is abnormal in a method calling mode in the prior art is solved, the crash probability of the application program is reduced, and the stability of the application program is improved.
Example two
Fig. 2 is a flowchart of an execution control method of an application program in the second embodiment of the present invention, and this embodiment further details the process of skipping to execute an exception handling method when the pre-execution result is an exception on the basis of the above embodiment.
Correspondingly, the method of the embodiment may include:
s210, in the normal execution process of the application program, judging whether the calling of the target native monitoring method is detected, if so, executing S220, otherwise, returning to execute S210.
S220, pre-executing the target native monitoring method in the target safety calling method matched with the target native monitoring method.
S230, judging whether the pre-execution result of the target native monitoring method is abnormal, if so, executing S240, otherwise, executing S210.
And S240, acquiring the exception type.
The exception type may be that the server returns exception data, the call interface is improperly used, the application program is in an operation error, and the like. Correspondingly, the exception handling method can be used for intercepting exceptions or processing exception data and the like, and the embodiment of the invention does not limit the type and the specific content of the exception handling method and the matching relation between the exception type and the exception handling method.
S250, in at least one exception handling method predefined in the target safe calling method, obtaining a target exception handling method matched with the exception type, and skipping to execute the target exception handling method.
Different exception types may correspond to different exception handling methods, and correspondingly, the secure calling method may encapsulate the matched native monitoring method and one or more exception handling methods. And when the pre-execution result is abnormal and the exception handling method needs to be called, determining the pre-executed exception type of the target native monitoring method, and executing the exception handling method matched with the exception type.
According to the technical scheme of the embodiment of the invention, the native monitoring method is packaged in the matched safe calling method, when the native monitoring method is called in the normal execution process of the application program, the native monitoring method is pre-executed, and when the pre-execution result is abnormal, the matched abnormal processing method is determined in the safe calling method according to the abnormal type, and the abnormal processing method is skipped to be executed. The problem that the application program is easy to crash when calling is abnormal or service data is abnormal in a method calling mode in the prior art is solved, the crash probability of the application program is reduced, and the stability of the application program is improved.
EXAMPLE III
Fig. 3 is a flowchart of a testing method for an application according to a third embodiment of the present invention, where this embodiment is applicable to a case where a native monitoring method is called during a testing process of an application, and the method may be executed by a testing apparatus for an application, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in a terminal device or a server. As shown in fig. 3, the method includes:
s310, in the test execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in the target safe calling method matched with the target native monitoring method.
In the application program, each native monitoring method is packaged in the matched safe calling method.
In the embodiment of the invention, when the native monitoring method is also required to be called in the test execution process of the application program, the native monitoring method is pre-executed in the safety calling method. The test execution process of the application program specifically refers to a stage of performance test by a tester before the application program is online.
S320, if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method, and outputting abnormal alarm information.
In the embodiment of the invention, in the test process of the application program, if the pre-execution result of the native monitoring method is abnormal, not only an abnormal processing method needs to be called to ensure the normal operation of the application program, but also an abnormal warning information prompt needs to be carried out, so that a tester can find the calling abnormality in time to repair the abnormal condition.
According to the technical scheme of the embodiment of the invention, the native monitoring method is packaged in the matched safe calling method, when the native monitoring method is called in the testing process of the application program, the native monitoring method is pre-executed, and when the pre-execution result is abnormal, the abnormal alarm information is output. On the premise of ensuring smooth execution of the whole testing process, the abnormal calling problem aiming at a specific data object or the abnormal calling problem aiming at a set function method can be recorded and completely output, so that a tester can quickly locate the abnormal problem and effectively repair the application program, the collapse risk of the application program is reduced from another dimension, and the stability of the application program is improved.
Example four
Fig. 4 is a flowchart of a detection method for a program code according to a fourth embodiment of the present invention, where this embodiment is applicable to a case where the program code is detected during development, uploading, and maintenance of the program code, and the method may be executed by a detection apparatus for the program code, where the detection apparatus may be implemented by software and/or hardware, and may be generally integrated in a terminal device or a server. As shown in fig. 4, the method includes:
s410, obtaining a code to be submitted, and identifying a native monitoring method in the code to be submitted.
The code to be submitted is the code which needs to be submitted to the online code platform after the application program is developed. The online code platform is used for browsing the source code, managing the source code defect and annotating the source code, and may be a GitLab, a GitHub, a bitchunk, a code cloud, and the like.
S420, if it is detected that the first target native monitoring method in the code to be submitted is not packaged in the matched safe calling method, the code to be submitted is prevented from being submitted to an online code platform, and warning information matched with the first target native monitoring method is generated.
The native monitoring method in the code to be submitted can be detected whether encapsulated inside the secure calling method or not by compiling code checking plug-ins such as sonar lint, but the detection mode is not limited in the embodiment.
Optionally, if it is detected that all the native monitoring methods in the code to be submitted are encapsulated in the matched secure calling method, the code to be submitted may be submitted to an online code platform, so as to implement online processing on the code to be submitted.
In the embodiment of the invention, after the application program is developed and before the code to be submitted is submitted to the online code platform, if the native monitoring method in the code to be submitted is detected not to be encapsulated in the matched safe calling method, the submission of the code to be submitted is blocked, and the abnormal alarm information prompt is carried out, so that an application program developer can encapsulate the unencapsulated native monitoring method in time, and the potential safety hazard in the code to be submitted is reduced.
According to the technical scheme of the embodiment of the invention, the code to be submitted is detected, and when the native monitoring method in the code to be submitted is not packaged into the security calling method, the submission of the code to be submitted is blocked and the alarm prompt is carried out. And the native monitoring method is guaranteed to be encapsulated in the safe calling method from another dimension, so that the problem that the application program is closed abnormally easily when calling abnormality or service data abnormality occurs in method calling in the prior art is solved, the potential safety hazard of the application program is reduced, and the stability of the application program is improved.
On the basis of the above embodiments, the method may further include: detecting an online code in the online code platform and identifying a native monitoring method in the online code;
and if the second target native monitoring method in the online code is not packaged in the matched safety calling method, generating alarm information matched with the second target native monitoring method.
Specifically, the online code in the online code platform can be detected regularly (for example, 1 week for 1 time), and a native monitoring method which is not safely packaged in the online code is found, so that the native monitoring method is further ensured to be packaged in the safe calling method, the potential safety hazard of the application program is further reduced, and the stability of the application program is improved.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an execution control apparatus of an application program according to a fifth embodiment of the present invention, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in a terminal device or a server. The device comprises: a first method pre-execution module 510 and a first exception handling method execution module 520. Wherein:
a first method pre-execution module 510, configured to pre-execute, in a target secure call method matching a target native monitoring method, the target native monitoring method if a call to the target native monitoring method is detected during normal execution of an application;
in the application program, each native monitoring method is packaged in the matched safe calling method;
a first exception handling method executing module 520, configured to jump to execute an exception handling method in the target secure call method if a pre-execution result of the target native monitoring method is abnormal.
According to the technical scheme of the embodiment of the invention, the native monitoring method is encapsulated inside the matched safe calling method, when the native monitoring method is called in the normal execution process of the application program, the native monitoring method is pre-executed, and when the pre-execution result is abnormal, the abnormal processing method in the safe calling method is skipped to be executed. The method solves the problem that the abnormal closing of the application program is easily caused by a method calling mode in the prior art when calling is abnormal or service data is abnormal, avoids the abnormal closing of the application program and improves the stability of the application program.
On the basis of the above embodiment, the method for monitoring the native state includes: a calling method and/or a character conversion method for a data object with a set type;
the data object includes: an array, and/or a collection.
On the basis of the foregoing embodiment, the first exception handling method execution module 520 includes:
an exception type obtaining unit, configured to obtain an exception type if a pre-execution result of the target native monitoring method is an exception;
and the first exception handling method execution unit is used for acquiring a target exception handling method matched with the exception type in at least one exception handling method predefined in the target safe calling method, and skipping to execute the target exception handling method.
The execution control device of the application program provided by the embodiment of the invention can execute the execution control method of the application program provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE six
Fig. 6 is a schematic structural diagram of an apparatus for testing an application according to a sixth embodiment of the present invention, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in a terminal device or a server. The device includes: a second method pre-execution module 610 and a second exception handling method execution module 620. Wherein:
a second method pre-execution module 610, configured to pre-execute the target native monitoring method in a target secure calling method matched with the target native monitoring method if a call to the target native monitoring method is detected during a test execution of the application;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and a second exception handling method executing module 620, configured to jump to execute an exception handling method in the target secure call method and output alarm information of the exception if the pre-execution result of the target native monitoring method is an exception.
According to the technical scheme of the embodiment of the invention, the native monitoring method is encapsulated inside the matched safe calling method, when the native monitoring method is called in the testing process of the application program, the native monitoring method is pre-executed, and when the pre-execution result is abnormal, the abnormal processing method in the safe calling method is skipped to execute. The problem that the method calling mode in the prior art easily causes abnormal closing of the application program when calling is abnormal or service data is abnormal is solved, the abnormal closing of the application program is avoided, and the stability of the application program is improved.
The test device for the application program provided by the embodiment of the invention can execute the test method for the application program provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE seven
Fig. 7 is a schematic structural diagram of a detecting apparatus for program codes according to a seventh embodiment of the present invention, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in a terminal device or a server. The device includes: a native monitoring method identification module 710 and an alert information generation module 720. Wherein:
the native monitoring method identification module 710 is configured to obtain a code to be submitted and identify a native monitoring method in the code to be submitted;
and an alarm information generating module 720, configured to, if it is detected that the first target native monitoring method in the code to be submitted is not encapsulated inside the matched secure calling method, prevent the code to be submitted from being submitted to an online code platform, and generate alarm information matched with the first target native monitoring method.
According to the technical scheme of the embodiment of the invention, the code to be submitted is detected, and when the native monitoring method in the code to be submitted is not encapsulated into the security calling method, the submission of the code to be submitted is blocked and the alarm prompt is carried out. The problem that in the prior art, when the method is called, calling abnormity occurs or service data is abnormal, the application program is easily closed abnormally is solved, the potential safety hazard of the application program is reduced, and the stability of the application program is improved.
On the basis of the above embodiment, the apparatus further includes:
the online code native monitoring method identification module is used for detecting the online code in the online code platform and identifying the native monitoring method in the online code;
and the on-line code alarm information generation module is used for generating alarm information matched with the second target native monitoring method if the second target native monitoring method in the on-line code is not encapsulated in the matched safety calling method.
The detection device for the program code provided by the embodiment of the invention can execute the detection method for the program code provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example eight
Fig. 8 is a schematic structural diagram of an electronic device according to an eighth disclosure of the embodiment of the present invention. FIG. 8 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 8 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present invention.
As shown in FIG. 8, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 8 and commonly referred to as a "hard drive"). Although not shown in FIG. 8, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 over the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, to name a few.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing an execution control method of an application program provided by an embodiment of the present invention. Namely: an execution control method for an application program is realized, and comprises the following steps:
in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method.
The application program testing method provided by the embodiment of the invention can also be realized, and comprises the following steps:
in the test execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method and outputting the abnormal alarm information.
The method for detecting the program code provided by the embodiment of the invention can also be realized, and comprises the following steps:
acquiring a code to be submitted, and identifying a native monitoring method in the code to be submitted;
and if the first target native monitoring method in the code to be submitted is detected not to be encapsulated in the matched safe calling method, stopping submitting the code to be submitted to an online code platform, and generating alarm information matched with the first target native monitoring method.
Example nine
The ninth embodiment of the present invention further discloses a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an execution control method for an application program, and the method includes:
in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method.
The method for testing the application program can also be realized, and comprises the following steps:
in the test execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
and if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method, and outputting the abnormal alarm information.
A method for detecting program code may also be implemented, including:
acquiring a code to be submitted, and identifying a native monitoring method in the code to be submitted;
and if the first target native monitoring method in the code to be submitted is detected not to be encapsulated in the matched safe calling method, stopping submitting the code to be submitted to an online code platform, and generating alarm information matched with the first target native monitoring method.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example, but is not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + + or the like and conventional procedural programming languages, such as the C language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (11)

1. An execution control method of an application program, comprising:
in the normal execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
2. The method of claim 1, wherein the native monitoring method comprises: calling method for data object with set type and/or character conversion method;
the data object includes: an array, and/or a collection.
3. The method of claim 1, wherein if the pre-execution result of the target native monitoring method is abnormal, skipping execution of an exception handling method in the target secure call method comprises:
if the pre-execution result of the target native monitoring method is abnormal, acquiring an abnormal type;
and in at least one exception handling method predefined in the target safe calling method, acquiring a target exception handling method matched with the exception type, and skipping to execute the target exception handling method.
4. A method for testing an application program, comprising:
in the test execution process of the application program, if the calling of the target native monitoring method is detected, the target native monitoring method is pre-executed in a target safe calling method matched with the target native monitoring method;
in the application program, each native monitoring method is packaged in the matched safe calling method;
if the pre-execution result of the target native monitoring method is abnormal, skipping to execute an abnormal processing method in the target safe calling method and outputting abnormal alarm information;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
5. A method for detecting a program code, comprising:
acquiring a code to be submitted, and identifying a native monitoring method in the code to be submitted;
if the first target native monitoring method in the code to be submitted is detected not to be packaged in the matched safe calling method, the code to be submitted is prevented from being submitted to an online code platform, and warning information matched with the first target native monitoring method is generated;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
6. The method of claim 5, further comprising:
detecting an online code in the online code platform and identifying a native monitoring method in the online code;
and if the second target native monitoring method in the online code is not packaged in the matched safety calling method, generating alarm information matched with the second target native monitoring method.
7. An execution control device for an application program, comprising:
the first method pre-execution module is used for pre-executing the target native monitoring method in a target safe calling method matched with the target native monitoring method if the calling of the target native monitoring method is detected in the normal execution process of the application program;
in the application program, each native monitoring method is packaged in the matched safe calling method;
the first exception handling method execution module is used for skipping to execute an exception handling method in the target safe calling method if the pre-execution result of the target native monitoring method is abnormal;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
8. An apparatus for testing an application, comprising:
the second method pre-execution module is used for pre-executing the target native monitoring method in a target safe calling method matched with the target native monitoring method if the calling of the target native monitoring method is detected in the test execution process of the application program;
in the application program, each native monitoring method is packaged in the matched safe calling method;
the second exception handling method execution module is used for skipping to execute an exception handling method in the target safe calling method and outputting the abnormal alarm information if the pre-execution result of the target native monitoring method is abnormal;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
9. An apparatus for detecting a program code, comprising:
the native monitoring method identification module is used for acquiring a code to be submitted and identifying a native monitoring method in the code to be submitted;
the warning information generation module is used for preventing the code to be submitted from being submitted to an online code platform and generating warning information matched with the first target native monitoring method if the fact that the first target native monitoring method in the code to be submitted is not packaged in the matched security calling method is detected;
the native monitoring method is a method which is easy to generate abnormity in the calling process so as to have safety risk; the safe calling method is generated by packaging the native monitoring method, and the safe calling method is matched with the native monitoring method.
10. An electronic device comprising one or more processors; storage means for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method of controlling execution of an application program as claimed in any one of claims 1 to 3, or to implement a method of testing an application program as claimed in claim 4, or to implement a method of detecting program code as claimed in claim 5 or 6.
11. A storage medium containing computer-executable instructions for performing, when executed by a computer processor, an execution control method of an application program according to any one of claims 1 to 3, or implementing a test method of an application program according to claim 4, or implementing a detection method of a program code according to claim 5 or 6.
CN202010995468.4A 2020-09-21 2020-09-21 Program execution control method, program execution test device, code detection device, program execution equipment and medium Active CN112181761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010995468.4A CN112181761B (en) 2020-09-21 2020-09-21 Program execution control method, program execution test device, code detection device, program execution equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010995468.4A CN112181761B (en) 2020-09-21 2020-09-21 Program execution control method, program execution test device, code detection device, program execution equipment and medium

Publications (2)

Publication Number Publication Date
CN112181761A CN112181761A (en) 2021-01-05
CN112181761B true CN112181761B (en) 2023-01-31

Family

ID=73955681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010995468.4A Active CN112181761B (en) 2020-09-21 2020-09-21 Program execution control method, program execution test device, code detection device, program execution equipment and medium

Country Status (1)

Country Link
CN (1) CN112181761B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109284217A (en) * 2018-09-28 2019-01-29 平安科技(深圳)有限公司 Application exception processing method, device, electronic equipment and storage medium
CN109408265A (en) * 2018-09-28 2019-03-01 广州虎牙信息科技有限公司 A kind of guard method, device, terminal device and storage medium that IOS is operating abnormally
CN109901941A (en) * 2018-12-15 2019-06-18 中国平安人寿保险股份有限公司 Application crash processing method and processing device, computer installation and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102446325B1 (en) * 2015-06-24 2022-09-22 삼성전자주식회사 Operating Method For Application Program and electronic device supporting the same

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109284217A (en) * 2018-09-28 2019-01-29 平安科技(深圳)有限公司 Application exception processing method, device, electronic equipment and storage medium
CN109408265A (en) * 2018-09-28 2019-03-01 广州虎牙信息科技有限公司 A kind of guard method, device, terminal device and storage medium that IOS is operating abnormally
CN109901941A (en) * 2018-12-15 2019-06-18 中国平安人寿保险股份有限公司 Application crash processing method and processing device, computer installation and storage medium

Also Published As

Publication number Publication date
CN112181761A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
US9256517B1 (en) Display of aggregated stack traces in a source code viewer
CN102422261B (en) Exception raised notification
US20120331449A1 (en) Device, method and computer program product for evaluating a debugger script
CN112100072B (en) Static detection method, device, equipment and medium for application program code
CN113127050B (en) Application resource packaging process monitoring method, device, equipment and medium
CN114168222B (en) Method and device for acquiring time consumption during starting, terminal equipment and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN109218393B (en) Push implementation method, device, equipment and computer storage medium
CN112363753A (en) Data verification method and device, electronic equipment and storage medium
CN110597704B (en) Pressure test method, device, server and medium for application program
CN110727476B (en) Method, device, equipment and storage medium for generating authorization configuration file
CN111274130A (en) Automatic testing method, device, equipment and storage medium
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN113704102A (en) Application compliance detection method, device, equipment and medium
CN112181761B (en) Program execution control method, program execution test device, code detection device, program execution equipment and medium
CN110333964B (en) Abnormality log processing method and device, electronic equipment and storage medium
CN112069158A (en) Data restoration method, device, equipment and storage medium
CN112486496A (en) Method and equipment for generating and operating so file
CN112988192A (en) Version updating method and device, electronic equipment and storage medium
CN113127051B (en) Application resource packaging process monitoring method, device, equipment and medium
CN113760631A (en) Page loading duration determination method, device, equipment and storage medium
CN111078570A (en) Parameter format detection method, device, equipment and medium based on interface framework
CN113127002B (en) Method, device, equipment and medium for monitoring code compiling process
CN112416695B (en) Global variable monitoring method, device, equipment and storage medium
CN111240928B (en) Automatic detection method, device, equipment and storage medium for equipment drive

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
GR01 Patent grant
GR01 Patent grant