[PATCH] D41457: [libfuzzer] Fix UB when calculating Log(0) in StackDepthStepFunction().

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 11:32:41 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT321211: [libfuzzer] Fix UB when calculating Log(0) in StackDepthStepFunction(). (authored by Dor1s, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41457?vs=127761&id=127768#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D41457

Files:
  lib/fuzzer/FuzzerTracePC.h


Index: lib/fuzzer/FuzzerTracePC.h
===================================================================
--- lib/fuzzer/FuzzerTracePC.h
+++ lib/fuzzer/FuzzerTracePC.h
@@ -276,6 +276,7 @@
 
   // Step function, grows similar to 8 * Log_2(A).
   auto StackDepthStepFunction = [](uint32_t A) -> uint32_t {
+    if (!A) return A;
     uint32_t Log2 = Log(A);
     if (Log2 < 3) return A;
     Log2 -= 3;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41457.127768.patch
Type: text/x-patch
Size: 397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/8be82275/attachment.bin>


More information about the llvm-commits mailing list