about summary refs log tree commit diff
path: root/instrumentation
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-05-13 08:44:43 +0200
committervanhauser-thc <vh@thc.org>2024-05-13 08:44:43 +0200
commit24b9d74e70107a4517396d7fa940140e206398bf (patch)
tree1028ecfaeb0ce077111061eb7f903abc7f2afc2b /instrumentation
parent93c7cbd49603c1a256caf3ab6e971c9f4e40bab4 (diff)
downloadafl++-24b9d74e70107a4517396d7fa940140e206398bf.tar.gz
compcov int fix
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/split-compares-pass.so.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc
index 728ebc22..9b7bf256 100644
--- a/instrumentation/split-compares-pass.so.cc
+++ b/instrumentation/split-compares-pass.so.cc
@@ -1778,7 +1778,13 @@ bool SplitComparesTransform::runOnModule(Module &M) {
 
             auto op0 = CI->getOperand(0);
             auto op1 = CI->getOperand(1);
+            // has to valid operands
             if (!op0 || !op1) { continue; }
+            // has exactly one constant and one variable
+            int constants = 0;
+            if (dyn_cast<ConstantInt>(op0)) { ++constants; }
+            if (dyn_cast<ConstantInt>(op1)) { ++constants; }
+            if (constants != 1) { continue; }
 
             auto iTy1 = dyn_cast<IntegerType>(op0->getType());
             if (iTy1 && isa<IntegerType>(op1->getType())) {