From caf6ccb3a21e4cb239a20e9dda3ea8e0dbcdf904 Mon Sep 17 00:00:00 2001
From: Mihai Maruseac <mihaimaruseac@google.com>
Date: Tue, 8 Sep 2020 13:16:31 -0700
Subject: [PATCH] Remove fuzzer which is too small.

Because the fuzzer is too small, OSSFuzz sees it as broken, as it does not provide enough utility. Since we cover the API in another fuzzer, it's ok to remove this one instead of trying to artifically complicate.

PiperOrigin-RevId: 330572370
Change-Id: I23e80db12e5d2a0caba73346334095476617e554
---
 tensorflow/security/fuzzing/BUILD             |  9 ----
 .../fuzzing/consume_non_whitespace_fuzz.cc    | 51 -------------------
 2 files changed, 60 deletions(-)
 delete mode 100644 tensorflow/security/fuzzing/consume_non_whitespace_fuzz.cc

diff --git a/tensorflow/security/fuzzing/BUILD b/tensorflow/security/fuzzing/BUILD
index 75c62ec8bf1..2f2bf6d29b4 100644
--- a/tensorflow/security/fuzzing/BUILD
+++ b/tensorflow/security/fuzzing/BUILD
@@ -27,15 +27,6 @@ tf_fuzz_target(
     ],
 )
 
-tf_fuzz_target(
-    name = "consume_non_whitespace_fuzz",
-    srcs = ["consume_non_whitespace_fuzz.cc"],
-    deps = [
-        "//tensorflow/core/platform:str_util",
-        "//tensorflow/core/platform:stringpiece",
-    ],
-)
-
 tf_fuzz_target(
     name = "consume_leading_digits_fuzz",
     srcs = ["consume_leading_digits_fuzz.cc"],
diff --git a/tensorflow/security/fuzzing/consume_non_whitespace_fuzz.cc b/tensorflow/security/fuzzing/consume_non_whitespace_fuzz.cc
deleted file mode 100644
index 6d2b5b929b8..00000000000
--- a/tensorflow/security/fuzzing/consume_non_whitespace_fuzz.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-==============================================================================*/
-#include <cstdint>
-#include <cstdlib>
-
-#include "tensorflow/core/platform/str_util.h"
-#include "tensorflow/core/platform/stringpiece.h"
-
-// This is a fuzzer for tensorflow::str_util::ConsumeNonWhitespace
-
-namespace {
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
-  uint8_t *byte_data = const_cast<uint8_t *>(data);
-  char *char_data = reinterpret_cast<char *>(byte_data);
-
-  tensorflow::StringPiece sp(char_data, size);
-  tensorflow::StringPiece spe;
-
-  while (!sp.empty()) {
-    const size_t initial_size = sp.size();
-    (void)initial_size;  // "use" initial_size even if assert is disabled
-
-    const bool leading_whitespace =
-        tensorflow::str_util::ConsumeNonWhitespace(&sp, &spe);
-
-    if (leading_whitespace) {
-      assert(!spe.empty());
-    }
-    assert(initial_size == (sp.size() + spe.size()));
-
-    tensorflow::str_util::RemoveLeadingWhitespace(&sp);
-    assert(initial_size > sp.size());
-  }
-
-  return 0;
-}
-
-}  // namespace