forked from OSchip/llvm-project
parent
cfde1a26b4
commit
04b57c25bc
|
@ -297,6 +297,10 @@ public:
|
||||||
const ProgramState* addTaint(SymbolRef S,
|
const ProgramState* addTaint(SymbolRef S,
|
||||||
TaintTagType Kind = TaintTagGeneric) const;
|
TaintTagType Kind = TaintTagGeneric) const;
|
||||||
|
|
||||||
|
/// Create a new state in which the region symbol is marked as tainted.
|
||||||
|
const ProgramState* addTaint(const MemRegion *R,
|
||||||
|
TaintTagType Kind = TaintTagGeneric) const;
|
||||||
|
|
||||||
/// Check if the statement is tainted in the current state.
|
/// Check if the statement is tainted in the current state.
|
||||||
bool isTainted(const Stmt *S, TaintTagType Kind = TaintTagGeneric) const;
|
bool isTainted(const Stmt *S, TaintTagType Kind = TaintTagGeneric) const;
|
||||||
bool isTainted(SVal V, TaintTagType Kind = TaintTagGeneric) const;
|
bool isTainted(SVal V, TaintTagType Kind = TaintTagGeneric) const;
|
||||||
|
|
|
@ -658,13 +658,19 @@ const ProgramState* ProgramState::addTaint(const Stmt *S,
|
||||||
return addTaint(Sym, Kind);
|
return addTaint(Sym, Kind);
|
||||||
|
|
||||||
const MemRegion *R = getSVal(S).getAsRegion();
|
const MemRegion *R = getSVal(S).getAsRegion();
|
||||||
if (const SymbolicRegion *SR = dyn_cast_or_null<SymbolicRegion>(R))
|
addTaint(R, Kind);
|
||||||
return addTaint(SR->getSymbol(), Kind);
|
|
||||||
|
|
||||||
// Cannot add taint, so just return the state.
|
// Cannot add taint, so just return the state.
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ProgramState* ProgramState::addTaint(const MemRegion *R,
|
||||||
|
TaintTagType Kind) const {
|
||||||
|
if (const SymbolicRegion *SR = dyn_cast_or_null<SymbolicRegion>(R))
|
||||||
|
return addTaint(SR->getSymbol(), Kind);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
const ProgramState* ProgramState::addTaint(SymbolRef Sym,
|
const ProgramState* ProgramState::addTaint(SymbolRef Sym,
|
||||||
TaintTagType Kind) const {
|
TaintTagType Kind) const {
|
||||||
const ProgramState *NewState = set<TaintMap>(Sym, Kind);
|
const ProgramState *NewState = set<TaintMap>(Sym, Kind);
|
||||||
|
|
Loading…
Reference in New Issue