CN103927487B - Generate the method and device of the patterned structure tree of mobile intelligent terminal source code - Google Patents

Generate the method and device of the patterned structure tree of mobile intelligent terminal source code Download PDF

Info

Publication number
CN103927487B
CN103927487B CN201310016788.0A CN201310016788A CN103927487B CN 103927487 B CN103927487 B CN 103927487B CN 201310016788 A CN201310016788 A CN 201310016788A CN 103927487 B CN103927487 B CN 103927487B
Authority
CN
China
Prior art keywords
source code
intelligent terminal
mobile intelligent
point
branch
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
CN201310016788.0A
Other languages
Chinese (zh)
Other versions
CN103927487A (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.)
Information Center of Guangdong Power Grid Co Ltd
Original Assignee
Information Center of Guangdong Power Grid 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 Information Center of Guangdong Power Grid Co Ltd filed Critical Information Center of Guangdong Power Grid Co Ltd
Priority to CN201310016788.0A priority Critical patent/CN103927487B/en
Publication of CN103927487A publication Critical patent/CN103927487A/en
Application granted granted Critical
Publication of CN103927487B publication Critical patent/CN103927487B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a kind of method of the abstract syntax tree for generating mobile intelligent terminal source code, including:S1. the source code of mobile intelligent terminal is captured;S2. the conversion of data structure is carried out to described source code, finds out the trace point of the entrance of data flow to outlet;S3. multiple process threads are called according to described trace point, generates patterned structure tree;S4. described structure tree is preserved.The invention also discloses a kind of device of the abstract syntax tree for generating mobile intelligent terminal source code.In the method and device of the abstract syntax tree of the generation mobile intelligent terminal source code that the present invention is provided, the information included in abstract syntax tree is while program aasubsequent staticaanalysis needs are met, comprising other information less, find out that potential risks possibility is larger, improve the security of code.

Description

Generate the method and device of the patterned structure tree of mobile intelligent terminal source code
Technical field
The present invention relates to source code safety field, more particularly to a kind of generate mobile intelligent terminal source code graphical Structure tree method and device.
Background technology
In computer science, patterned structure tree (abstract syntax tree are abbreviated as AST), or Syntax tree (syntax tree), is the tree-shaped form of expression of the abstract syntax structure of source code, in particular to the source of programming language Code.Each node on tree represents a kind of structure in source code.Why say that grammer is " abstract ", be because here Grammer can't represent in true grammer occur each details.Such as, nested parenthesis are implied in the structure of tree, and Do not presented in the form of node;And similar to conditional jump sentence as if-condition-then, it is possible to use carry The node of Liang Ge branches is representing.
The selection of the concrete form of patterned structure tree (AST), i.e., the information included in patterned structure tree many Few, affect the efficiency of program analysis.Can patterned structure tree be properly generated, and will determine comprising enough information follow-up Program analysis success or failure, how to find the method for more effectively generating the patterned structure tree of mobile intelligent terminal source code And device, the completeness for improving code becomes one problem of people.
Content of the invention
Above for solving the problems, such as, the present invention provides the side of the patterned structure tree for generating mobile intelligent terminal source code Method and device.
The invention discloses a kind of method of the patterned structure tree for generating mobile intelligent terminal source code, including:
S1. the source code of mobile intelligent terminal is captured;
S2. the conversion of data structure is carried out to described source code, finds out the trace point of the entrance of data flow to outlet;
S3. multiple process threads are called according to described trace point, generates patterned structure tree;
S4. described patterned structure tree is preserved.
In the method for the patterned structure tree for generating mobile intelligent terminal source code of the present invention, described step Rapid S1 is carried out in compiler front-end to step S4.
In the method for the patterned structure tree for generating mobile intelligent terminal source code of the present invention, described with Track point includes branch point, convergent point.
In the method for the patterned structure tree for generating mobile intelligent terminal source code of the present invention, the step Also include step S5 after S4:The leak position of source code in described intelligent movable in the described patterned structure tree of crawl Terminal shows.
The invention discloses a kind of device of the patterned structure tree for generating mobile intelligent terminal source code, including:
Source code placement unit, for capturing the source code of mobile intelligent terminal;
Trace point searching unit, for carrying out the conversion of data structure to described source code, finds out the entrance of data flow Trace point to outlet;
Thread dispatching unit is processed, and for multiple process threads being called according to described trace point, generates patterned knot Paper mulberry;
Structure tree storage unit, for preserving described patterned structure tree.
In the device of the patterned structure tree for generating mobile intelligent terminal source code of the present invention, described, Device is located at compiler front-end.
In the device of the patterned structure tree for generating mobile intelligent terminal source code of the present invention, described with Track point includes branch point, convergent point.
In the device of the patterned structure tree for generating mobile intelligent terminal source code of the present invention, described knot Paper mulberry storage unit also has leak position display unit, for capturing the leak of source code in described patterned structure tree Position simultaneously shows in described mobile intelligent terminal.
The present invention a kind of generation mobile intelligent terminal source code patterned structure tree method and apparatus, with Lower beneficial effect:
In the technical program, the information included in patterned structure tree is meeting the same of program aasubsequent staticaanalysis needs When, comprising other information less, find out that potential risks possibility is larger, improve the security of code.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also To obtain other accompanying drawings according to these accompanying drawings.
Fig. 1 a are a kind of method stream of the patterned structure tree for generating mobile intelligent terminal source code of the embodiment of the present invention Journey schematic diagram;
Fig. 1 b are that the controlling stream graph in the source code in the present invention between two convergent points in method main shows as empty point Zhi Tu;
Fig. 2 is a kind of apparatus function of the patterned structure tree for generating mobile intelligent terminal source code of the embodiment of the present invention Block diagram.
Specific embodiment
The present invention can be further appreciated that by the specific embodiment of invention now given below, but they are not to this Bright restriction.For those skilled in the art is according to some nonessential improvement and adjustment that foregoing invention content is made, It is considered as and is within the scope of the present invention.
Refer to Fig. 1 a, first embodiment of the invention, a kind of patterned structure of generation mobile intelligent terminal source code The method of tree, including:
S1. the source code of mobile intelligent terminal is captured;
S2. the conversion of data structure is carried out to described source code, finds out the trace point of the entrance of data flow to outlet;
S3. multiple process threads are called according to described trace point, generates patterned structure tree;
S4. described patterned structure tree is preserved.
It is preferred that also including step S5 after step S4:In the structure tree of grabbing graphics the leak position of source code and Described mobile intelligent terminal shows.
Further, described step S1 is carried out in compiler front-end to step S4,
Further, described trace point includes branch point, convergent point.
Branch point refers to that program judges the judging section of sentence, and these judge that sentence is executed according to the different of result of determination Different branches.As sentence is judged, each branch point has " inflow " branch and multiple " outflow " branches;Special, When the decision condition on branch point is a constant, branch point only one of which " flows out " branch.Branch point has five types, point Dui Ying not the various judging sections for judging sentence:
1) if branch points:If (exp) part of corresponding if sentences.
2) switch branch points:Switch (exp) part of corresponding switch sentences.
3) for branch points:For (the init of corresponding for sentences;exp;Inc) part.
4) while branch points:While (exp) part of corresponding while statement.
5) do-while branch points:While (exp) part of corresponding do-while.
Branch point is represented with rhombus in figure, and the keyword of marker for judgment sentence.
Convergent point refers to the position that more than one controlling stream brings together in program.Generally, this position is not correspondingly appointed What sentence or sentence segment, and correspond to an abstract end position of program statement.Convergent point has multiple " inflow " branches, But only one of which does not have the branch of " outflow ".Convergent point can be divided into following several types:
1) judge the convergent point of sentence:Each judges that sentence has a convergent point, positioned at " end " position for judging statement block Put.
2) convergent point of labelled statement:Each label has a convergent point, positioned at label ":" after.
3) convergent point of case and default:Be located at its ":" after.
4) method entrance:Opening bracket " { " corresponding to method body.
5) method end point:Correspond to method body closes bracket " } ".
6) branch's jump-point:Correspond to skip instruction.
Branch point and convergent point are collectively referred to as the node in controlling stream, in the case where strictly not distinguishing, are referred to as branch point.
If there is a direct controlling stream between any two node in program, i.e., from node execute 0 or Arbitrary finite bar sequential statement can reach another node, therebetween no longer comprising any other node, then claim the two nodes it Between direct controlling stream be a branch, the two nodes are referred to as adjacent node.Distinguishingly, direct between adjacent node Controlling stream, if being formed by 0 sequential statement is executed, the branch between the two nodes is referred to as empty branch.In source code Empty branch is shown as in the controlling stream of method main between two convergent points, as shown in Figure 1 b.
A kind of easy branch's number calculating method is that each node " flows out " branch's number sum in calculation procedure.
Following table provides the computational methods of " outflow " branch number of every kind of grammer and its corresponding branch point.
Fig. 2, a kind of device 1 of the patterned structure tree of generation mobile intelligent terminal source code is referred to, including:
Source code placement unit 10, for capturing the source code of mobile intelligent terminal;
Trace point searching unit 20, for carrying out the conversion of data structure to described source code, finds out entering for data flow Trace point of the mouth to outlet;
Thread dispatching unit 30 is processed, and for multiple process threads being called according to described trace point, is generated patterned Structure tree;
Structure tree storage unit 40, for preserving described patterned structure tree.
It is preferred that structure tree storage unit 40 also has leak position display unit 50, for the structure of grabbing graphics The leak position of source code show in described mobile intelligent terminal in tree.
Further, described device is located at compiler front-end.
Further, described trace point includes branch point, convergent point.
The present invention a kind of generation mobile intelligent terminal source code patterned structure tree method and apparatus, with Lower beneficial effect:
In the technical program, the information included in patterned structure tree is meeting the same of program aasubsequent staticaanalysis needs When, comprising other information less, find out that potential risks possibility is larger, improve the security of code.
Presently preferred embodiments of the present invention is the foregoing is only, not in order to limit the present invention, all in essence of the invention Within god and principle, any modification, equivalent substitution and improvements that is made etc. should be included within the scope of the present invention.

Claims (6)

1. a kind of generate mobile intelligent terminal source code patterned syntax tree method, it is characterised in that methods described bag Include following steps:
S1. the source code of mobile intelligent terminal is captured;
S2. the conversion of data structure is carried out to described source code, finds out the trace point of the entrance of data flow to outlet;
S3. multiple process threads are called according to described trace point, generates patterned structure tree;
S4. described patterned structure tree is preserved;
Described trace point includes branch point, convergent point;
Branch point and convergent point are collectively referred to as the node in controlling stream;Direct if there is one between any two node in program Controlling stream, i.e., execute arbitrary finite bar sequential statement from node and can reach another node, therebetween no longer comprising any its Its node, then the direct controlling stream between described two nodes is called a branch, and described two nodes are referred to as adjacent segments Point;Direct controlling stream between adjacent node, if being formed by 0 sequential statement is executed, between described two nodes Branch is referred to as empty branch;Empty branch is shown as in the controlling stream of method main between two convergent points in source code.
2. according to claim 1 generate mobile intelligent terminal source code patterned syntax tree method, its feature It is, described step S1 is carried out in compiler front-end to step S4.
3. according to claim 1 generate mobile intelligent terminal source code patterned syntax tree method, its feature It is, after step S4, also includes step S5:In the described patterned structure tree of crawl the leak position of source code and Described mobile intelligent terminal shows.
4. a kind of generate mobile intelligent terminal source code patterned syntax tree device, it is characterised in that include:
Source code placement unit, for capturing the source code of mobile intelligent terminal;
Trace point searching unit, for carrying out the conversion of data structure to described source code, finds out the entrance of data flow to going out The trace point of mouth;
Thread dispatching unit is processed, and for multiple process threads being called according to described trace point, generates patterned structure tree;
Structure tree storage unit, for preserving described patterned structure tree;
Described trace point includes branch point, convergent point;
Branch point and convergent point are collectively referred to as the node in controlling stream;Direct if there is one between any two node in program Controlling stream, i.e., can reach another node from a node arbitrary finite bar sequential statement, no longer include any other section therebetween Point, then the direct controlling stream between described two nodes is called a branch, and described two nodes are referred to as adjacent node;Phase Direct controlling stream between neighbors, if being formed by 0 sequential statement is executed, the branch between described two nodes claims Zuo Xu branches;Empty branch is shown as in the controlling stream of method main between two convergent points in source code.
5. according to claim 4 generate mobile intelligent terminal source code patterned syntax tree device, its feature It is, described device is located at compiler front-end.
6. according to claim 4 generate mobile intelligent terminal source code patterned syntax tree device, its feature It is, described structure tree storage unit also has leak position display unit, for capturing described patterned structure tree The leak position of middle source code simultaneously shows in described mobile intelligent terminal.
CN201310016788.0A 2013-01-16 2013-01-16 Generate the method and device of the patterned structure tree of mobile intelligent terminal source code Active CN103927487B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310016788.0A CN103927487B (en) 2013-01-16 2013-01-16 Generate the method and device of the patterned structure tree of mobile intelligent terminal source code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310016788.0A CN103927487B (en) 2013-01-16 2013-01-16 Generate the method and device of the patterned structure tree of mobile intelligent terminal source code

Publications (2)

Publication Number Publication Date
CN103927487A CN103927487A (en) 2014-07-16
CN103927487B true CN103927487B (en) 2017-03-15

Family

ID=51145705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310016788.0A Active CN103927487B (en) 2013-01-16 2013-01-16 Generate the method and device of the patterned structure tree of mobile intelligent terminal source code

Country Status (1)

Country Link
CN (1) CN103927487B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160124723A1 (en) * 2014-10-31 2016-05-05 Weixi Ma Graphically building abstract syntax trees
CN105893052B (en) * 2016-04-20 2019-04-16 中国银行股份有限公司 A kind of war packet analyzer

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0810523A2 (en) * 1996-05-15 1997-12-03 Motorola, Inc. Method for sequencing computer instruction execution in a data processing system
CN101055566A (en) * 2007-05-25 2007-10-17 金蝶软件(中国)有限公司 Function collection method and device of electronic data table

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0810523A2 (en) * 1996-05-15 1997-12-03 Motorola, Inc. Method for sequencing computer instruction execution in a data processing system
CN101055566A (en) * 2007-05-25 2007-10-17 金蝶软件(中国)有限公司 Function collection method and device of electronic data table

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Fuzzing漏洞挖掘与溢出利用分析技术研究;王颖;《中国优秀硕士学位论文全文数据库》;20120215;第1.2,1.3,2.1,2.3节,图3-8 *

Also Published As

Publication number Publication date
CN103927487A (en) 2014-07-16

Similar Documents

Publication Publication Date Title
CN104834837B (en) A kind of antialiasing method of binary code based on semanteme
CN103207903B (en) A kind of visualized graphs program topological sorting method
JP4962564B2 (en) Parallelization program generation method, parallelization program generation apparatus, and parallelization program generation program
CN104536898B (en) The detection method of c program parallel regions
CN102622259B (en) A kind of functional block function modelling method for visual programming
JP7218793B2 (en) Control flow system, non-transitory readable medium, and method for enhancing program functionality
US9043766B2 (en) Language translation using preprocessor macros
CN104794401A (en) Static-analysis-assisted symbolic execution vulnerability detection method
CN103348318A (en) Controlling the execution of adjacent instructions that are dependent upon a same data condition
CN105117336B (en) A kind of method that dynamically labeled processing control relies on
US8495560B2 (en) Converting an activity diagram into code
CN103020176A (en) Data block dividing method in XML parsing and XML parsing method
CN107367686A (en) A kind of generation method of RTL hardware Trojan horses test vector
CN100559347C (en) A kind of recognition methods of nested loop structure
CN102306098A (en) Implicit taint propagation system and scheme thereof
CN103927487B (en) Generate the method and device of the patterned structure tree of mobile intelligent terminal source code
CN112346730B (en) Intermediate representation generation method, computer equipment and storage medium
CN104899042B (en) A kind of embedded machine vision detection program developing method and system
CN103838616A (en) Tree program branch based computer program immediate compiling method
CN109634569A (en) Process implementation method, device, equipment and readable storage medium storing program for executing based on note
Cohen et al. Automatic generation of near-optimal linear-time translators for non-circular attribute grammars
CN103617049A (en) Code moving method based on complementary predicates
Sun et al. WCCV: Improving the vectorization of IF-statements with warp-coherent conditions
US10789203B2 (en) Data processing apparatus, data processing method, and program recording medium
WO2014064798A1 (en) Execution control method, and information processing device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 510000 eighteen, building 8, 6, Donggang Road, Yuexiu District, Guangzhou, Guangdong.

Patentee after: GUANGDONG POWER GRID CO., LTD. INFORMATION CENTER

Address before: 510600 eighteen, building 8, 6, Donggang Road, Yuexiu District, Guangzhou, Guangdong.

Patentee before: Information Center of Guangdong Power Grid Corporation