[Soot-list] Excluded & included not handled correctly?

Eric Bodden eric.bodden at ec-spride.de
Thu Jan 24 07:55:42 EST 2013


Hi Michael.

No I think this is correct.

isExcluded is implemented like this:

	public boolean isExcluded(SootClass sc) {
		String name = sc.getName();
		for (String pkg : excludedPackages) {
			if (name.startsWith(pkg)) {
				for (String inc : (List<String>) Options.v().include()) {
					if (name.startsWith(inc)) {
						return false;
					}
				}
				return true;
			}
		}
		return false;
	}

Note that it checks the include list.

Eric

On 24 January 2013 13:31, Michael Faes <rolve at trick17.ch> wrote:
> Hi everyone,
>
> I'm having issues using the -no-bodies-for-excluded options together
> with -include and -exclude.
>
> I excluded java. classes but included java.util. classes. What happens
> is that they all end up being phantom. After investigating a bit, I
> found this method in SootResolver:
>
> private void processResolveWorklist() {
>    for( int i = SootClass.BODIES; i >= SootClass.HIERARCHY; i-- ) {
>      while( !worklist[i].isEmpty() ) {
>        SootClass sc = (SootClass) worklist[i].removeFirst();
>        if( resolveEverything() ) {
>          boolean onlySignatures = sc.isPhantom() || (
>              Options.v().no_bodies_for_excluded() &&
>              Scene.v().isExcluded(sc) &&
>              // ^^^^^^^^^^^^^^^^^^^^^^^^
>              !Scene.v().getBasicClasses().contains(sc.getName())
>            );
>          if( onlySignatures ) {
>            bringToSignatures(sc);
>            sc.setPhantomClass();
>            if(sc.isPhantom()) {
>              for( SootMethod m: sc.getMethods() ) {
>                m.setPhantom(true);
>              }
>              for( SootField f: sc.getFields() ) {
>                f.setPhantom(true);
>              }
>            }
>          } else bringToBodies(sc);
>        } else {
>          switch(i) {
>            case SootClass.BODIES: bringToBodies(sc); break;
>            case SootClass.SIGNATURES: bringToSignatures(sc); break;
>            case SootClass.HIERARCHY: bringToHierarchy(sc); break;
>          }
>        }
>      }
>    }
> }
>
> Notice that on lien 8 it only checks if the class is excluded, not if
> it's also included. But the description of the -exclude option clearly
> states:
>
>  > If you specify both include and exclude options, first the classes
>  > from all excluded packages are marked as library classes, then the
>  > classes from all included packages are marked as application classes.
>
> Am I correct that this is a bug or am I doing something wrong again?
>
> Thanks for you help.
> Michael
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list



-- 
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list