[all-commits] [llvm/llvm-project] 554076: Add strcmp fuzz test.

Chris Gyurgyik via All-commits all-commits at lists.llvm.org
Tue Jun 23 04:25:47 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5540765be603676a6e93745bce0ca9f3cce3e6a0
      https://github.com/llvm/llvm-project/commit/5540765be603676a6e93745bce0ca9f3cce3e6a0
  Author: cgyurgyik <gyurgyikcp at gmail.com>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M libc/fuzzing/string/CMakeLists.txt
    A libc/fuzzing/string/strcmp_fuzz.cpp

  Log Message:
  -----------
  Add strcmp fuzz test.
Reviewed-by: todo
Differential Revision: https://reviews.llvm.org/D82247


  Commit: 4ffe2b24f5c7a856e607370e1e559e4c94803809
      https://github.com/llvm/llvm-project/commit/4ffe2b24f5c7a856e607370e1e559e4c94803809
  Author: cgyurgyik <gyurgyikcp at gmail.com>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M libc/fuzzing/string/strcmp_fuzz.cpp

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/8a9311940a26...4ffe2b24f5c7


More information about the All-commits mailing list