Skip to content

False positive of RTA points-to analysis #1393

Open
@tisble

Description

Hi, I found a case that can help improving Wala. Please see the minimized code example below:

public class Example1 {
  public static void main(String[] args) {
      foo(new C1(), new C2());
  }
  public static void foo(C n1, C n2) {
      // code...
  }
}
interface C {}
class C1 implements C {}
class C2 implements C {}

In this example, the concrete type of the first parameter in foo should only be One as it is only initlialized by new One(), but Wala provides One and Two. The second parameter has similar issue.

Wala version: 1.6.4

Code

public void run() throws CallGraphBuilderCancelException, IOException, ClassHierarchyException {
    AnalysisScope scope = AnalysisScopeReader.instance.makeJavaBinaryAnalysisScope(INPUT_DIR, walaExclusionFile);
    IClassHierarchy cha = ClassHierarchyFactory.make(scope);
    Iterable<Entrypoint> entryPoints = Util.makeMainEntrypoints(cha); // default entry: main method
    AnalysisOptions options = new AnalysisOptions(scope, entryPoints);
    AnalysisCache cache = new AnalysisCacheImpl();
    CallGraphBuilder<InstanceKey> builder = Util.makeRTABuilder(options, cache, cha);
    PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions