about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--docs/Changelog.md1
-rw-r--r--instrumentation/split-switches-pass.so.cc6
2 files changed, 3 insertions, 4 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index c4786bf3..6ab1794c 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -56,6 +56,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
     - better selective instrumentation AFL_LLVM_{ALLOW|DENY}LIST
       on filename matching (requires llvm 11 or newer)
     - fixed a potential crash in targets for LAF string handling
+    - fixed a bad assert in LAF split switches
     - added AFL_USE_TSAN thread sanitizer support
     - llvm and LTO mode modified to work with new llvm 14-dev (again. again.)
     - fix for AFL_REAL_LD
diff --git a/instrumentation/split-switches-pass.so.cc b/instrumentation/split-switches-pass.so.cc
index 85a35c2a..9f9e7eca 100644
--- a/instrumentation/split-switches-pass.so.cc
+++ b/instrumentation/split-switches-pass.so.cc
@@ -118,8 +118,6 @@ BasicBlock *SplitSwitchesTransform::switchConvert(
   std::vector<uint8_t> setSizes;
   std::vector<std::set<uint8_t> > byteSets(BytesInValue, std::set<uint8_t>());
 
-  assert(ValTypeBitWidth >= 8 && ValTypeBitWidth <= 64);
-
   /* for each of the possible cases we iterate over all bytes of the values
    * build a set of possible values at each byte position in byteSets */
   for (CaseExpr &Case : Cases) {
@@ -350,9 +348,9 @@ bool SplitSwitchesTransform::splitSwitches(Module &M) {
 
     /* If there is only the default destination or the condition checks 8 bit or
      * less, don't bother with the code below. */
-    if (!SI->getNumCases() || bitw <= 8) {
+    if (SI->getNumCases() < 2 || bitw % 8 || bitw > 64) {
 
-      // if (!be_quiet) errs() << "skip trivial switch..\n";
+      // if (!be_quiet) errs() << "skip switch..\n";
       continue;
 
     }