@@ -75,10 +75,26 @@ public abstract class RelationalTaintAbstractDomain
7575 * @param memory the memory element
7676 */
7777 protected RelationalTaintAbstractDomain (RelationalTaintElement [] stack , RelationalTaintElement memory ) {
78+ this (stack , 0 , 0 , memory );
79+ }
80+
81+ /**
82+ * Builds a taint abstract stack starting from a given stack, a list of
83+ * elements that push taint, the head and the tail of the given stack.
84+ * Builds a taint abstract stack starting from a given stack and a memory
85+ * element.
86+ *
87+ * @param stack the stack of values
88+ * @param memory the memory element
89+ * @param head the head index of the circular stack
90+ * @param tail the tail index of the circular stack
91+ */
92+ protected RelationalTaintAbstractDomain (RelationalTaintElement [] stack , int head , int tail ,
93+ RelationalTaintElement memory ) {
7894 this .stack = stack ;
7995 this .memory = memory ;
80- this .head = 0 ;
81- this .tail = 0 ;
96+ this .head = head ;
97+ this .tail = tail ;
8298 }
8399
84100 @ Override
@@ -185,7 +201,7 @@ public RelationalTaintAbstractDomain smallStepSemantics(ValueExpression expressi
185201
186202 Statement stmt = (Statement ) pp ;
187203 if (this .isTainted (stmt ))
188- return mk (resultStack .stack , RelationalTaintElement
204+ return mk (resultStack .stack , resultStack . head , resultStack . tail , RelationalTaintElement
189205 .newRelationalTaintedElement (((ProgramCounterLocation ) stmt .getLocation ()).getPc ()));
190206
191207 return resultStack ;
@@ -235,7 +251,7 @@ else if (memory.isClean())
235251 RelationalTaintElement value = resultStack .pop ();
236252
237253 if (value .isTaint ())
238- return mk (resultStack .stack ,
254+ return mk (resultStack .stack , resultStack . head , resultStack . tail ,
239255 RelationalTaintElement .newRelationalTaintedElement (value .getProgramPoints ()));
240256 else if (value .isClean ())
241257 return resultStack ;
@@ -766,7 +782,7 @@ public RelationalTaintAbstractDomain glbAux(RelationalTaintAbstractDomain other)
766782 for (int i = 0 ; i < STACK_LIMIT ; i ++) {
767783 result [i ] = this .get (i ).glb (other .get (i ));
768784 }
769- return mk (result , this .memory .glb (other .memory ));
785+ return mk (result , head , tail , this .memory .glb (other .memory ));
770786 }
771787
772788 /**
@@ -784,7 +800,7 @@ public RelationalTaintAbstractDomain lubAux(RelationalTaintAbstractDomain other)
784800 for (int i = 0 ; i < STACK_LIMIT ; i ++) {
785801 result [i ] = this .get (i ).lub (other .get (i ));
786802 }
787- return mk (result , this .memory .lub (other .memory ));
803+ return mk (result , head , tail , this .memory .lub (other .memory ));
788804 }
789805
790806 /**
@@ -876,7 +892,7 @@ public boolean hasBottomUntil(int x) {
876892 @ Override
877893 public RelationalTaintAbstractDomain clone () {
878894 RelationalTaintElement [] newArray = stack .clone ();
879- RelationalTaintAbstractDomain copy = mk (newArray , memory );
895+ RelationalTaintAbstractDomain copy = mk (newArray , head , tail , memory );
880896 copy .head = this .head ;
881897 copy .tail = this .tail ;
882898 return copy ;
@@ -979,5 +995,6 @@ else if (isTop())
979995 *
980996 * @return a new concrete instance of {@link RelationalTaintAbstractDomain}
981997 */
982- public abstract RelationalTaintAbstractDomain mk (RelationalTaintElement [] stack , RelationalTaintElement memory );
998+ public abstract RelationalTaintAbstractDomain mk (RelationalTaintElement [] stack , int head , int tail ,
999+ RelationalTaintElement memory );
9831000}
0 commit comments