Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: testing/libfuzzer/fuzzers/prtime_fuzzer.cc

Issue 2346723002: Add fuzzer for PRTime() from NSPR. (Closed)
Patch Set: Revert PS #2. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/libfuzzer/fuzzers/dicts/prtime.dict ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stddef.h>
6 #include <stdint.h>
7
8 #include <string>
9
10 #include "base/third_party/nspr/prtime.h"
11
12 PRTime parsed_time;
13
14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15 if (size < 1)
16 return 0;
17
18 const uint8_t selector = data[0];
19
20 // Using std::string instead of a (potentially faster) fixed buffer to catch
21 // accesses beyond the end of the string.
22 std::string str(reinterpret_cast<const char*>(data+1), size - 1);
23 PR_ParseTimeString(str.c_str(), selector & 1, &parsed_time);
24
25 return 0;
26 }
OLDNEW
« no previous file with comments | « testing/libfuzzer/fuzzers/dicts/prtime.dict ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698