Skip to content

Commit ae0e5ac

Browse files
author
Dragon
committedAug 30, 2017
bfc unsupport InvokeInst
1 parent 42f732c commit ae0e5ac

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
 

‎lib/Transforms/Obfuscation/BogusControlFlow.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,26 @@ namespace {
138138
}
139139
// If fla annotations
140140
if(toObfuscate(flag,&F,"bcf")) {
141-
bogus(F);
142-
doF(*F.getParent());
143-
return true;
141+
if (isInvoke(&F)) {
142+
bogus(F);
143+
doF(*F.getParent());
144+
return true;
145+
}
144146
}
145147

146148
return false;
147149
} // end of runOnFunction()
148150

151+
bool isInvoke(Function *f) {
152+
for (Function::iterator i = f->begin(); i != f->end(); ++i) {
153+
BasicBlock *bb = &*i;
154+
if (isa<InvokeInst>(bb->getTerminator())) {
155+
return false;
156+
}
157+
}
158+
return true;
159+
}
160+
149161
void bogus(Function &F) {
150162
// For statistics and debug
151163
++NumFunction;

0 commit comments

Comments
 (0)