[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:
- Take the value of the first byte; this is size1. (Credits to @PaulkaToast for this idea).
- size2 is the value of size - size1.
- Copy the characters to new containers, data1 and data2 with corresponding sizes.
- Add a null terminator to the first container, and verify the second container has a null terminator.
- 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.
clang-tidy: warning: invalid case style for function 'LLVMFuzzerTestOneInput' [readability-identifier-naming]
not useful
clang-tidy: warning: invalid case style for parameter 'data' [readability-identifier-naming]
not useful
clang-tidy: warning: invalid case style for parameter 'size' [readability-identifier-naming]
not useful