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

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

Issue 2391393005: Remove openssl_bio_string. (Closed)
Patch Set: Created 4 years, 2 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/BUILD.gn ('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 <stdint.h>
6
7 #include "crypto/openssl_bio_string.h"
8 #include "crypto/scoped_openssl_types.h"
9
10
11 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
12 if (size == 0) { return 0; }
13
14 std::string buffer;
15 std::string input(reinterpret_cast<const char*>(data), size);
16
17 std::size_t data_hash = std::hash<std::string>()(input);
18 uint8_t choice = data_hash % 3;
19
20 crypto::ScopedBIO bio(crypto::BIO_new_string(&buffer));
21 if (choice == 0) {
22 BIO_printf(bio.get(), "%s", input.c_str());
23 } else if (choice == 1) {
24 BIO_write(bio.get(), input.c_str(), size);
25 } else {
26 BIO_puts(bio.get(), input.c_str());
27 }
28 BIO_flush(bio.get());
29
30 return 0;
31 }
32
OLDNEW
« no previous file with comments | « testing/libfuzzer/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698