Files
rk35xx-android14/external/cronet/testing/libfuzzer/fuzzers/prtime_fuzzer.cc
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

27 lines
679 B
C++

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include <string>
#include "base/third_party/nspr/prtime.h"
PRTime parsed_time;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 1)
return 0;
const uint8_t selector = data[0];
// Using std::string instead of a (potentially faster) fixed buffer to catch
// accesses beyond the end of the string.
std::string str(reinterpret_cast<const char*>(data+1), size - 1);
PR_ParseTimeString(str.c_str(), selector & 1, &parsed_time);
return 0;
}