Skip to content

Fix 1602#1610

Merged
linghuiluo merged 2 commits intodevelopfrom
fix1602
May 18, 2021
Merged

Fix 1602#1610
linghuiluo merged 2 commits intodevelopfrom
fix1602

Conversation

@linghuiluo
Copy link
Copy Markdown
Member

The bug in #1602 affects the call graph, because the EntryPoints.clinitOf is used in the call graph construction.
This patch fixes the missing edges to some static initializers.

@linghuiluo linghuiluo requested a review from StevenArzt May 13, 2021 16:44
@linghuiluo linghuiluo changed the base branch from master to develop May 13, 2021 16:44
@DongjieHe
Copy link
Copy Markdown
Contributor

@linghuiluo Hi, your fix seems correct now according to its specification (i.e., " Returns a list of all clinits of class cl and its superclasses."). But it still misses "<soot.IA: void clinit()>" which I mentioned in the example in #1602 and thus still affects the on-the-fly callgraph construction.

@linghuiluo
Copy link
Copy Markdown
Member Author

linghuiluo commented May 14, 2021

@DongjieHe That edge from main to IA.clinit is not there, because there is no method with the signature IA.clinit in the IR.
Also, as I checked the bytecode of the interface IA, no static initializer in it.

@linghuiluo
Copy link
Copy Markdown
Member Author

linghuiluo commented May 14, 2021

@DongjieHe Below is description from Java spec, it basically means there is no static initializer in IA at all, because you only have a String field in IA:

Note that interface fields that are constant variables (§4.12.4) are initialized before other interface fields. This also applies to static fields that are constant variables in classes (§8.3.2). Such fields will never be observed to have their default initial values (§4.12.5), even by devious programs.

A constant variable is a final variable of primitive type or type String that is initialized with a constant expression (§15.28). Whether a variable is a constant variable or not may have implications with respect to class initialization (§12.4.1), binary compatibility (§13.1, §13.4.9), and definite assignment (§16 (Definite Assignment)).

@linghuiluo linghuiluo merged commit 3966f56 into develop May 18, 2021
@linghuiluo linghuiluo deleted the fix1602 branch May 28, 2021 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants