[libc-commits] [PATCH] D149359: [libc] add exception to atof differential fuzz

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 27 12:34:31 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/fuzzing/stdlib/atof_differential_fuzz.cpp:41
+bool should_be_skipped(const uint8_t *str) {
+  double init_result = __llvm_libc::atof(reinterpret_cast<const char *>(str));
+  if (init_result < 0) {
----------------
michaelrj wrote:
> sivachandra wrote:
> > Can there be a way to do this without using `__llvm_libc::atof`?
> Not really. We need to use some version of `atof`, either the system's or ours. The thing we're trying to detect here is hexadecimal subnormals, and the process for checking that is exactly the process for converting a string to a float. 
Let me rephrase my question: can you detect problem inputs using the system libc `atof`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149359/new/

https://reviews.llvm.org/D149359



More information about the libc-commits mailing list