aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-02-04 18:57:27 +0100
committervanhauser-thc <vh@thc.org>2021-02-04 18:57:27 +0100
commitec737f3368e678cbee3a916d4ef6fb683ebfa1f0 (patch)
treed4cfd739c2c096d71b9d38ceeef8f2391fcf0d7a
parent208254f47c146291e580637d583e1be19cd094d2 (diff)
downloadafl++-ec737f3368e678cbee3a916d4ef6fb683ebfa1f0.tar.gz
workaroung for llvm LTO bitcast bug
-rw-r--r--instrumentation/cmplog-instructions-pass.cc23
1 files changed, 2 insertions, 21 deletions
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index d4bc0b38..b5cc1882 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -265,7 +265,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
unsigned int max_size = Val->getType()->getIntegerBitWidth(), cast_size;
unsigned char do_cast = 0;
- if (!SI->getNumCases() || max_size <= 8) {
+ if (!SI->getNumCases() || max_size < 16 || max_size % 8) {
// if (!be_quiet) errs() << "skip trivial switch..\n";
continue;
@@ -275,17 +275,6 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
IRBuilder<> IRB(SI->getParent());
IRB.SetInsertPoint(SI);
- if (max_size % 8) {
-
- // bitcast from i6 to i8 panics llvm, so ...
- continue;
- /*
- max_size = (((max_size / 8) + 1) * 8);
- do_cast = 1;
- */
-
- }
-
if (max_size > 128) {
if (!be_quiet) {
@@ -551,15 +540,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
}
- if (!max_size) { continue; }
-
- // _ExtInt() with non-8th values
- if (max_size % 8) {
-
- max_size = (((max_size / 8) + 1) * 8);
- do_cast = 1;
-
- }
+ if (!max_size || max_size % 8 || max_size < 16) { continue; }
if (max_size > 128) {