Class ConstantMapStrategy

java.lang.Object
soot.jimple.infoflow.collections.strategies.containers.ConstantMapStrategy
All Implemented Interfaces:
IContainerStrategy
Direct Known Subclasses:
AbstractListStrategy

public class ConstantMapStrategy extends Object implements IContainerStrategy
Strategy that only reasons about maps with constant keys
Author:
Tim Lange
  • Field Details

  • Constructor Details

    • ConstantMapStrategy

      public ConstantMapStrategy(InfoflowManager manager)
  • Method Details

    • getResolvedKeys

      public long getResolvedKeys()
    • getUnresolvedKeys

      public long getUnresolvedKeys()
    • intersect

      public Tristate intersect(ContainerContext apKey, ContainerContext stmtKey)
      Description copied from interface: IContainerStrategy
      Checks whether the two arguments intersect
      Specified by:
      intersect in interface IContainerStrategy
      Parameters:
      apKey - key from the access path
      stmtKey - key from the statement
      Returns:
      true if args fully intersects, maybe on part match and false on definitely no match
    • append

      public ContainerContext[] append(ContainerContext[] ctxt1, ContainerContext[] ctxt2)
      Description copied from interface: IContainerStrategy
      Return the union of the given contexts
      Specified by:
      append in interface IContainerStrategy
      Parameters:
      ctxt1 - key from the access path
      ctxt2 - key from the statement
      Returns:
      new context definition
    • getKeyContext

      public ContainerContext getKeyContext(soot.Value value, soot.jimple.Stmt stmt)
      Description copied from interface: IContainerStrategy
      Retrieves a context for a given key
      Specified by:
      getKeyContext in interface IContainerStrategy
      Parameters:
      value - requested value
      stmt - statement containing key
      Returns:
      new context definition
    • shouldResolveIndex

      protected boolean shouldResolveIndex(soot.Value base)
      Checks whether an index should be resolved. This is a special case, where Lists and Sets share the same interface (Collection), yet we do not track Sets and thus, don't need to query the index for Sets.
      Parameters:
      base - base local
      Returns:
      true if index should be resovled
    • getIndexContext

      public ContainerContext getIndexContext(soot.Value value, soot.jimple.Stmt stmt)
      Description copied from interface: IContainerStrategy
      Retrieves a context for a given index
      Specified by:
      getIndexContext in interface IContainerStrategy
      Parameters:
      value - requested value
      stmt - statement containing index
      Returns:
      new context definition
    • getNextPosition

      public ContainerContext getNextPosition(soot.Value value, soot.jimple.Stmt stmt)
      Description copied from interface: IContainerStrategy
      Retrieves a context given an implicit key after the given statement (i.e. a list where the key is dependent on the number of add calls before)
      Specified by:
      getNextPosition in interface IContainerStrategy
      Parameters:
      value - list
      stmt - statement that uses value
      Returns:
      new context definition
    • getFirstPosition

      public ContainerContext getFirstPosition(soot.Value value, soot.jimple.Stmt stmt)
      Description copied from interface: IContainerStrategy
      Retrieves a context given an implicit key before the given statement (i.e. a list where the key is dependent on the number of add calls before)
      Specified by:
      getFirstPosition in interface IContainerStrategy
      Parameters:
      value - list
      stmt - statement that uses value
      Returns:
      new context definition
    • getLastPosition

      public ContainerContext getLastPosition(soot.Value value, soot.jimple.Stmt stmt)
      Description copied from interface: IContainerStrategy
      Retrieves a context given an implicit key before the given statement (i.e. a list where the key is dependent on the number of add calls before)
      Specified by:
      getLastPosition in interface IContainerStrategy
      Parameters:
      value - list
      stmt - statement that uses value
      Returns:
      new context definition
    • lessThanEqual

      public Tristate lessThanEqual(ContainerContext ctxt1, ContainerContext ctxt2)
      Description copied from interface: IContainerStrategy
      Returns whether ctxt1 is less than ctxt2
      Specified by:
      lessThanEqual in interface IContainerStrategy
      Parameters:
      ctxt1 - first context
      ctxt2 - second context
      Returns:
      true ctxt1 is less than ctxt2
    • shift

      public ContainerContext shift(ContainerContext ctxt, int n, boolean exact)
      Description copied from interface: IContainerStrategy
      Shifts the ctxt to the right
      Specified by:
      shift in interface IContainerStrategy
      Parameters:
      ctxt - current context
      Returns:
      new context definition
    • shouldSmash

      public boolean shouldSmash(ContainerContext[] ctxts)
      Description copied from interface: IContainerStrategy
      Returns whether the context is still useful or not
      Specified by:
      shouldSmash in interface IContainerStrategy
      Parameters:
      ctxts - contexts
      Returns:
      true if context contains no useful information and thus, the collection should be smashed
    • isReadOnly

      public boolean isReadOnly(soot.Unit unit)
      Description copied from interface: IContainerStrategy
      Returns whether the given value is used in a read-only fashion
      Specified by:
      isReadOnly in interface IContainerStrategy
      Parameters:
      unit - current statement
      Returns:
      true if is read-only