[llvm] r317500 - [cfi-verify] Added a simple check that stops division-by-zero error when no indirect CF instructions are found in the provided file.

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 11:14:09 PST 2017


Author: hctim
Date: Mon Nov  6 11:14:09 2017
New Revision: 317500

URL: http://llvm.org/viewvc/llvm-project?rev=317500&view=rev
Log:
[cfi-verify] Added a simple check that stops division-by-zero error when no indirect CF instructions are found in the provided file.

Modified:
    llvm/trunk/tools/llvm-cfi-verify/llvm-cfi-verify.cpp

Modified: llvm/trunk/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cfi-verify/llvm-cfi-verify.cpp?rev=317500&r1=317499&r2=317500&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cfi-verify/llvm-cfi-verify.cpp (original)
+++ llvm/trunk/tools/llvm-cfi-verify/llvm-cfi-verify.cpp Mon Nov  6 11:14:09 2017
@@ -132,8 +132,10 @@ void printIndirectCFInstructions(FileAna
   uint64_t IndirectCFInstructions = ExpectedProtected + UnexpectedProtected +
                                     ExpectedUnprotected + UnexpectedUnprotected;
 
-  if (IndirectCFInstructions == 0)
+  if (IndirectCFInstructions == 0) {
     outs() << "No indirect CF instructions found.\n";
+    return;
+  }
 
   outs() << formatv("Expected Protected: {0} ({1:P})\n"
                     "Unexpected Protected: {2} ({3:P})\n"




More information about the llvm-commits mailing list