This is an archive of the discontinued LLVM Phabricator instance.

[libc] use LLVM atof for fuzz precheck
AbandonedPublic

Authored by michaelrj on May 15 2023, 11:23 AM.

Details

Reviewers
sivachandra
lntue
Summary

The atof differential fuzz precheck skips all hexadecimal subnormals
since glibc's atof doesn't round them correctly. By using glibc's atof
to check if the number is a hexadecimal subnormal it was found that it
sometimes rounds down to zero when it should round up to the minimum
subnormal. This bypassed the check since 0 does not count as a
subnormal. This patch solves the issue by using the LLVM-libc
implementation of atof.

Diff Detail

Event Timeline

michaelrj created this revision.May 15 2023, 11:23 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 15 2023, 11:23 AM
michaelrj requested review of this revision.May 15 2023, 11:23 AM
lntue accepted this revision.May 15 2023, 11:33 AM
This revision is now accepted and ready to land.May 15 2023, 11:33 AM

I am fine with this, but it is kind of reducing the validity of the fuzz test - we are ignoring the correctness check of a class of inputs using the libc's own results. Could we use MPFR and not depend on the system libc at all? MPFR has functions like mpfr_set_str and mpfr_strtofr which perform the atof operation.