Class SubstringDomain

  • All Implemented Interfaces:
    it.unive.lisa.analysis.BaseLattice<SubstringDomain>, it.unive.lisa.analysis.Lattice<SubstringDomain>, it.unive.lisa.analysis.ScopedObject<SubstringDomain>, it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>, it.unive.lisa.analysis.value.ValueDomain<SubstringDomain>, it.unive.lisa.analysis.value.ValueOracle, it.unive.lisa.util.representation.StructuredObject, java.lang.Iterable<java.util.Map.Entry<it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>>

    public class SubstringDomain
    extends it.unive.lisa.analysis.lattices.FunctionalLattice<SubstringDomain,​it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>
    implements it.unive.lisa.analysis.value.ValueDomain<SubstringDomain>
    The substring relational abstract domain, tracking relation between string expressions. The domain is implemented as a FunctionalLattice, mapping identifiers to string expressions, tracking which string expressions are definitely substring of an identifier. This domain follows the one defined in this paper.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice

        it.unive.lisa.analysis.lattices.FunctionalLattice.FunctionalLift<V extends it.unive.lisa.analysis.Lattice<V>>, it.unive.lisa.analysis.lattices.FunctionalLattice.KeyFunctionalLift<K extends java.lang.Object>
    • Field Summary

      • Fields inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice

        function, lattice
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        SubstringDomain()
      Builds the top abstract value.
      protected SubstringDomain​(it.unive.lisa.analysis.lattices.ExpressionInverseSet lattice, java.util.Map<it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet> function)
      Builds the abstract value by cloning the given function.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected SubstringDomain add​(it.unive.lisa.symbolic.SymbolicExpression expr, it.unive.lisa.symbolic.value.Identifier id)
      Adds a single expression (expr) for id to the this abstract value.
      protected SubstringDomain add​(java.util.Set<it.unive.lisa.symbolic.SymbolicExpression> exprs, it.unive.lisa.symbolic.value.Identifier id)
      Adds a set of expressions (exprs) for id to the this abstract value.
      SubstringDomain assign​(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      SubstringDomain assume​(it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint src, it.unive.lisa.program.cfg.ProgramPoint dest, it.unive.lisa.analysis.SemanticOracle oracle)  
      SubstringDomain bottom()  
      protected SubstringDomain closure()
      Performs the closure over the domain.
      SubstringDomain forgetIdentifier​(it.unive.lisa.symbolic.value.Identifier id)  
      SubstringDomain forgetIdentifiersIf​(java.util.function.Predicate<it.unive.lisa.symbolic.value.Identifier> test)  
      SubstringDomain glbAux​(SubstringDomain other)  
      boolean knowsIdentifier​(it.unive.lisa.symbolic.value.Identifier id)  
      SubstringDomain lubAux​(SubstringDomain other)  
      SubstringDomain mk​(it.unive.lisa.analysis.lattices.ExpressionInverseSet lattice, java.util.Map<it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet> function)  
      SubstringDomain popScope​(it.unive.lisa.analysis.ScopeToken token)  
      SubstringDomain pushScope​(it.unive.lisa.analysis.ScopeToken token)  
      it.unive.lisa.analysis.lattices.Satisfiability satisfies​(it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      SubstringDomain smallStepSemantics​(it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      it.unive.lisa.analysis.lattices.ExpressionInverseSet stateOfUnknown​(it.unive.lisa.symbolic.value.Identifier key)  
      SubstringDomain top()  
      • Methods inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice

        equals, functionalLift, getKeys, getMap, getOtDefault, getState, getValues, glbKeys, hashCode, isBottom, isTop, iterator, lessOrEqualAux, lubKeys, mkNewFunction, narrowingAux, putState, representation, toString, wideningAux
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface it.unive.lisa.analysis.BaseLattice

        glb, lessOrEqual, lub, narrowing, widening
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface it.unive.lisa.analysis.Lattice

        isBottom, isTop
      • Methods inherited from interface it.unive.lisa.analysis.SemanticDomain

        forgetIdentifiers, getAllDomainInstances, getDomainInstance
      • Methods inherited from interface it.unive.lisa.util.representation.StructuredObject

        representation
      • Methods inherited from interface it.unive.lisa.analysis.value.ValueDomain

        applyReplacement
    • Constructor Detail

      • SubstringDomain

        public SubstringDomain()
        Builds the top abstract value.
      • SubstringDomain

        protected SubstringDomain​(it.unive.lisa.analysis.lattices.ExpressionInverseSet lattice,
                                  java.util.Map<it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet> function)
        Builds the abstract value by cloning the given function.
        Parameters:
        lattice - the underlying lattice
        function - the function to clone
    • Method Detail

      • lubAux

        public SubstringDomain lubAux​(SubstringDomain other)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lubAux in interface it.unive.lisa.analysis.BaseLattice<SubstringDomain>
        Overrides:
        lubAux in class it.unive.lisa.analysis.lattices.FunctionalLattice<SubstringDomain,​it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • glbAux

        public SubstringDomain glbAux​(SubstringDomain other)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        glbAux in interface it.unive.lisa.analysis.BaseLattice<SubstringDomain>
        Overrides:
        glbAux in class it.unive.lisa.analysis.lattices.FunctionalLattice<SubstringDomain,​it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • stateOfUnknown

        public it.unive.lisa.analysis.lattices.ExpressionInverseSet stateOfUnknown​(it.unive.lisa.symbolic.value.Identifier key)
        Specified by:
        stateOfUnknown in class it.unive.lisa.analysis.lattices.FunctionalLattice<SubstringDomain,​it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>
      • mk

        public SubstringDomain mk​(it.unive.lisa.analysis.lattices.ExpressionInverseSet lattice,
                                  java.util.Map<it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet> function)
        Specified by:
        mk in class it.unive.lisa.analysis.lattices.FunctionalLattice<SubstringDomain,​it.unive.lisa.symbolic.value.Identifier,​it.unive.lisa.analysis.lattices.ExpressionInverseSet>
      • assign

        public SubstringDomain assign​(it.unive.lisa.symbolic.value.Identifier id,
                                      it.unive.lisa.symbolic.value.ValueExpression expression,
                                      it.unive.lisa.program.cfg.ProgramPoint pp,
                                      it.unive.lisa.analysis.SemanticOracle oracle)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        assign in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • smallStepSemantics

        public SubstringDomain smallStepSemantics​(it.unive.lisa.symbolic.value.ValueExpression expression,
                                                  it.unive.lisa.program.cfg.ProgramPoint pp,
                                                  it.unive.lisa.analysis.SemanticOracle oracle)
                                           throws it.unive.lisa.analysis.SemanticException
        Specified by:
        smallStepSemantics in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • assume

        public SubstringDomain assume​(it.unive.lisa.symbolic.value.ValueExpression expression,
                                      it.unive.lisa.program.cfg.ProgramPoint src,
                                      it.unive.lisa.program.cfg.ProgramPoint dest,
                                      it.unive.lisa.analysis.SemanticOracle oracle)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        assume in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • knowsIdentifier

        public boolean knowsIdentifier​(it.unive.lisa.symbolic.value.Identifier id)
        Specified by:
        knowsIdentifier in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
      • forgetIdentifier

        public SubstringDomain forgetIdentifier​(it.unive.lisa.symbolic.value.Identifier id)
                                         throws it.unive.lisa.analysis.SemanticException
        Specified by:
        forgetIdentifier in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • forgetIdentifiersIf

        public SubstringDomain forgetIdentifiersIf​(java.util.function.Predicate<it.unive.lisa.symbolic.value.Identifier> test)
                                            throws it.unive.lisa.analysis.SemanticException
        Specified by:
        forgetIdentifiersIf in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • satisfies

        public it.unive.lisa.analysis.lattices.Satisfiability satisfies​(it.unive.lisa.symbolic.value.ValueExpression expression,
                                                                        it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                        it.unive.lisa.analysis.SemanticOracle oracle)
                                                                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        satisfies in interface it.unive.lisa.analysis.SemanticDomain<SubstringDomain,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • pushScope

        public SubstringDomain pushScope​(it.unive.lisa.analysis.ScopeToken token)
                                  throws it.unive.lisa.analysis.SemanticException
        Specified by:
        pushScope in interface it.unive.lisa.analysis.ScopedObject<SubstringDomain>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • popScope

        public SubstringDomain popScope​(it.unive.lisa.analysis.ScopeToken token)
                                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        popScope in interface it.unive.lisa.analysis.ScopedObject<SubstringDomain>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • add

        protected SubstringDomain add​(java.util.Set<it.unive.lisa.symbolic.SymbolicExpression> exprs,
                                      it.unive.lisa.symbolic.value.Identifier id)
                               throws it.unive.lisa.analysis.SemanticException
        Adds a set of expressions (exprs) for id to the this abstract value.
        Parameters:
        exprs - the set of symbolic expressions
        id - the identifier
        Returns:
        a new abstract value with the added expressions
        Throws:
        it.unive.lisa.analysis.SemanticException - if an error occurs during the computation
      • add

        protected SubstringDomain add​(it.unive.lisa.symbolic.SymbolicExpression expr,
                                      it.unive.lisa.symbolic.value.Identifier id)
                               throws it.unive.lisa.analysis.SemanticException
        Adds a single expression (expr) for id to the this abstract value.
        Parameters:
        expr - the symbolic expression
        id - the identifier
        Returns:
        a new abstract value with the added expression
        Throws:
        it.unive.lisa.analysis.SemanticException - if an error occurs during the computation
      • closure

        protected SubstringDomain closure()
                                   throws it.unive.lisa.analysis.SemanticException
        Performs the closure over the domain.
        Returns:
        A copy of the domain with the added relations
        Throws:
        it.unive.lisa.analysis.SemanticException - if an error occurs during the computation