message: Update consume_non_whitespace_fuzz.cc
diff: -/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
  +/* Copyright 2021 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.
  @@ -21,7 +21,7 @@ limitations under the License.
  #include <fuzzer/FuzzedDataProvider.h>
  -// This is a fuzzer for tensorflow::str_util::ConsumeNonWhitespace
  +// This is a fuzzer for tensorflow::str_util::ConsumeLeadingDigits
  namespace {
  @@ -29,20 +29,14 @@ 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);
  - if(char_data == NULL) return 0;
  -
  tensorflow::StringPiece sp(char_data, size);
  - tensorflow::StringPiece spe("");
  -
  - while(sp.size() > 0) {
  - const size_t initial_size = sp.size();
  - const bool leading_whitespace = tensorflow::str_util::ConsumeNonWhitespace(&sp, &spe);
  - const char lead_char_consume_whitespace = *(sp.data());
  - if(leading_whitespace) {
  - assert(!isspace(lead_char_consume_whitespace));
  - }
  - tensorflow::str_util::RemoveLeadingWhitespace(&sp);
  - assert(initial_size > sp.size());
  + tensorflow::uint64 val;
  +
  + const bool leading_digits = tensorflow::str_util::ConsumeLeadingDigits(&sp, &val);
  + const char lead_char_consume_digits = *(sp.data());
  + if (leading_digits) {
  + assert(lead_char_consume_digits < '0' && lead_char_consume_digits > '9');
  + assert(val >= 0);
  }
  return 0;
  