[libcxx-commits] [libcxx] c6b8c3d - [libc++] Tolerate NaN returning random distributions for now

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 12 14:11:27 PST 2019


Author: Eric Fiselier
Date: 2019-12-12T17:11:13-05:00
New Revision: c6b8c3d5d9a37b24bffa0bfc085a81f041bedc18

URL: https://github.com/llvm/llvm-project/commit/c6b8c3d5d9a37b24bffa0bfc085a81f041bedc18
DIFF: https://github.com/llvm/llvm-project/commit/c6b8c3d5d9a37b24bffa0bfc085a81f041bedc18.diff

LOG: [libc++] Tolerate NaN returning random distributions for now

Added: 
    

Modified: 
    libcxx/fuzzing/fuzzing.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/fuzzing/fuzzing.cpp b/libcxx/fuzzing/fuzzing.cpp
index 7e58dba0c27f..1840c26d4b95 100644
--- a/libcxx/fuzzing/fuzzing.cpp
+++ b/libcxx/fuzzing/fuzzing.cpp
@@ -807,8 +807,14 @@ int random_distribution_helper(const uint8_t *data, size_t size) {
     return 0;
   Distribution d(p);
   volatile auto res = d(engine);
-  if (std::isnan(res))
-    return 1;
+  if (std::isnan(res)) {
+    // FIXME(llvm.org/PR44289):
+    // Investigate why these distributions are returning NaN and decide
+    // if that's what we want them to be doing.
+    //
+    // Make this assert false (or return non-zero).
+    return 0;
+  }
   return 0;
 }
 


        


More information about the libcxx-commits mailing list