Commit Graph

14 Commits

Author SHA1 Message Date
Siva Chandra Reddy
7f7b0dc4e1 [libc] Add implementations of nextafter[f|l] functions.
A differential fuzzer for these functions has also been added.
Along the way, a small correction has been done to the normal/subnormal
limits of x86 long double values.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D94109
2021-01-05 22:32:39 -08:00
Siva Chandra Reddy
4766a86cf2 [libc] Combine all math differential fuzzers into one target.
Also added diffing of a few more math functions. Combining the diff check
for all of these functions helps us meet the OSS fuzz bar of a minimum of
100 program edges.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D91817
2020-11-20 07:46:15 -08:00
Siva Chandra Reddy
892ed1f150 [libc] Add differential fuzzers for ldexp and remquo.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D91763
2020-11-19 08:32:05 -08:00
cgyurgyik
e14a7ff762 [libc] Adds fuzz test for strstr and alphabetizes string fuzz CMakeList.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84611
2020-07-29 16:35:59 -04:00
cgyurgyik
b07feef873 [libc] This commit fixes the strcmp fuzzing test. It uses a single input and
splits it into two by using the value of the first byte to determine the
length of the first string. Reviewed-by: PaulkaToast, Differential
Revision: https://reviews.llvm.org/D82427

Summary:
[libc] Since only one input is given, it is necessary to split the string into two containers so that they can be compared for the purposes of this fuzz test. This is done in the following manner:

1. Take the value of the first byte; this is size1. (Credits to @PaulkaToast for this idea).
2. size2 is the value of size - size1.
3. Copy the characters to new containers, data1 and data2 with corresponding sizes.
4. Add a null terminator to the first container, and verify the second container has a null terminator.
5. Verify output of strcmp.

A simpler alternative considered was simply splitting the input data into two, but this means the two strings are always within +- 1 character of each other. This above implementation avoids this.

ninja check-libc was run; no issues.

Reviewers: PaulkaToast, sivachandra

Reviewed By: PaulkaToast

Subscribers: mgorny, tschuett, ecnelises, libc-commits, PaulkaToast

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82427
2020-06-28 12:50:04 -05:00
cgyurgyik
8bec88e638 Remove strcmp fuzz from CMakeList since it breaks build. 2020-06-23 12:52:36 -04:00
Simon Pilgrim
f1c671925b Add stddef.h to fix missing size_t type build errors. 2020-06-23 13:12:18 +01:00
cgyurgyik
4ffe2b24f5 [libc] Add fuzz test for strcmp.
Summary:
Adds a fuzz test for string comparison.

This takes in two strings with associated lengths.
Verifies each string contains at least one character, and that the last character is the null terminator.
Then, finds the first instance where one of the following does not hold:
1. i < min(size1, size2)
2. s1[i] == s2[i]
3. s1[i] != '\0'

The result of strcmp is then compared to the value of the difference between s1[i] and s2[i]. For thoroughness, the operands are reversed and also checked.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra, PaulkaToast

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82247
2020-06-23 07:24:03 -04:00
cgyurgyik
5540765be6 Add strcmp fuzz test.
Reviewed-by: todo
Differential Revision: https://reviews.llvm.org/D82247
2020-06-23 07:20:39 -04:00
Siva Chandra Reddy
e4767a6f14 [libc] Add fully-qualified target names.
Only targets setup by the special LLVM libc rules now have fully
qualified names. The naming style is similar to fully qualified names in
Python.

Reviewers: abrachet, PaulkaToast, phosek

Differential Revision: https://reviews.llvm.org/D77340
2020-04-10 18:01:52 -07:00
Paula Toth
66d00feb18 [libc][NFC] Make all top of file comments consistent.
Summary:
Made all header files consistent based of this documentation: https://llvm.org/docs/CodingStandards.html#file-headers.
And did the same for all source files top of file comments.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77533
2020-04-08 10:18:37 -07:00
Paula Toth
90eb7be6a1 [libc] Fix memcpy to adhere to qualified calls.
Summary: Switched to using the new memcpy implementation.

Reviewers: sivachandra, abrachet, gchatelet

Reviewed By: abrachet, gchatelet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77277
2020-04-03 15:27:57 -07:00
Paula Toth
1fcfd30fae [libc] Add strlen implementation.
Summary: This should fix the call to a non internal libc function.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra

Subscribers: xbolva00, mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77279
2020-04-03 15:11:35 -07:00
Paula Toth
a4f45ee73a [libc] Lay out framework for fuzzing libc functions.
Summary:
Added fuzzing test for strcpy and some documentation related to fuzzing.
This will be the first step in integrating this with oss-fuzz.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: gchatelet, abrachet, mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D74091
2020-02-21 19:15:46 -08:00