-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRandomnessDependencyAbstractDomain.java
More file actions
64 lines (54 loc) · 2.03 KB
/
RandomnessDependencyAbstractDomain.java
File metadata and controls
64 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package it.unipr.analysis.taint;
import it.unipr.cfg.*;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.symbolic.value.Operator;
import java.util.Set;
public class RandomnessDependencyAbstractDomain extends TaintAbstractDomain {
private static final RandomnessDependencyAbstractDomain TOP = new RandomnessDependencyAbstractDomain(
createFilledArray(TaintAbstractDomain.STACK_LIMIT, TaintElement.BOTTOM), 0, 0, TaintElement.CLEAN);
private static final RandomnessDependencyAbstractDomain BOTTOM = new RandomnessDependencyAbstractDomain(null, 0, 0,
TaintElement.BOTTOM);
/**
* Constructs a new {@code RandomnessDependencyAbstractDomain} with an empty
* (BOTTOM) stack, zero head/tail, and CLEAN memory state.
*/
public RandomnessDependencyAbstractDomain() {
this(createFilledArray(STACK_LIMIT, TaintElement.BOTTOM), 0, 0, TaintElement.CLEAN);
}
/**
* Constructs a new {@code RandomnessDependencyAbstractDomain} with the
* given stack state, stack pointers, and memory state.
*
* @param stack the stack array containing taint information for each
* element
* @param head the current head pointer of the stack
* @param tail the current tail pointer of the stack
* @param memory the taint state of the memory
*/
protected RandomnessDependencyAbstractDomain(TaintElement[] stack, int head, int tail, TaintElement memory) {
super(stack, head, tail, memory);
}
@Override
public boolean isTainted(Statement stmt) {
return stmt instanceof Timestamp
|| stmt instanceof Blockhash
|| stmt instanceof Difficulty
|| stmt instanceof Balance;
}
@Override
public Set<Operator> getSanitizedOpcode() {
return Set.of();
}
@Override
public RandomnessDependencyAbstractDomain top() {
return TOP;
}
@Override
public RandomnessDependencyAbstractDomain bottom() {
return BOTTOM;
}
@Override
public TaintAbstractDomain mk(TaintElement[] stack, int head, int tail, TaintElement memory) {
return new RandomnessDependencyAbstractDomain(stack, head, tail, memory);
}
}