Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soot resolved an incorrect method signautre #2021

Open
sarser2048 opened this issue Nov 17, 2023 · 4 comments
Open

Soot resolved an incorrect method signautre #2021

sarser2048 opened this issue Nov 17, 2023 · 4 comments

Comments

@sarser2048
Copy link

Describe the bug
I used Soot to analyze some real-world projects, and found it provides an incorrect method signature, which has redundant single quotes.

Input file
Maven Repo Link

The correct signature should be:
com.fasterxml.jackson.core.util.JacksonFeatureSet: com.fasterxml.jackson.core.util.JacksonFeatureSet with(com.fasterxml.jackson.core.util.JacksonFeature)

However, I got the incorrect results with redudant single quotes in the method name.
6141700197768_ pic

To reproduce
Directly use Soot analyze this class file and retrieve the method signature:

for (SootClass klass : Scene.v().getApplicationClasses()) {
  if (klass.isConcrete() && klass.getName().startsWith(PKG_NAME)) {
      for (SootMethod method : klass.getMethods()) {
          if(method.isJavaLibraryMethod()) {
              continue;
          }
          method.retrieveActiveBody();
          if (!method.hasActiveBody()) {
              System.out.println("No Active Body: " + method.getName());
              continue;
          }
          // .......
@sarser2048
Copy link
Author

There is a similar problem when analyzing the following method:

<com.fasterxml.jackson.core.io.ContentReference: com.fasterxml.jackson.core.io.ContentReference 'unknown'()>

@MarcMil
Copy link
Contributor

MarcMil commented Nov 23, 2023

This happens when the method name is a reserved name in Jimple:

private void setReservedNames() {

Otherwise we would have a problem when you write out Jimple files and try to read them back in. See the quotedNameOf method.

@canliture
Copy link
Contributor

look here, same problem: #1697

@sarser2048
Copy link
Author

sarser2048 commented Dec 27, 2023

@MarcMil Thanks for your kind reply. Yes, I know Soot has the reserved names. However, the method quotedNameOf cannot work well when I used it.

For the following two used method signatures:

1st signature
<com.fasterxml.jackson.databind.introspect.CollectorBase: com.fasterxml.jackson.databind.introspect.AnnotationCollector collectDefaultAnnotations(com.fasterxml.jackson.databind.introspect.AnnotationCollector,java.lang.annotation.Annotation[])

2nd signature
<com.fasterxml.jackson.core.util.JacksonFeatureSet: com.fasterxml.jackson.core.util.JacksonFeatureSet with(com.fasterxml.jackson.core.util.JacksonFeature)>

The first signature can be converted to (annotation -> 'annotation'), but we cannot get the quoted version (with -> 'with') of the second signuatre when invoke Scene.v().quotedNameOf().

Soot may only use dot to seperate the given name, however, we often use method signature to get a resovled SootMethod. I think the method quotedNameOf should be improved.

And, another problem is, not all reserved names will be changed to quoted version, e.g., void.

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

No branches or pull requests

3 participants