[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 207/256: ossfuzz: don't write out to stdout
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 207/256: ossfuzz: don't write out to stdout |
Date: |
Fri, 06 Oct 2017 19:44:58 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit e239eda39e3f0f9342bc0dd6658b49d4bd900875
Author: Max Dymond <address@hidden>
AuthorDate: Mon Sep 11 20:00:27 2017 +0100
ossfuzz: don't write out to stdout
Don't make the fuzzer write out to stdout - instead write some of the
contents to a memory block so we exercise the data output code but
quietly.
Closes #1885
---
tests/fuzz/curl_fuzzer.cc | 30 ++++++++++++++++++++++++++++++
tests/fuzz/curl_fuzzer.h | 10 ++++++++++
2 files changed, 40 insertions(+)
diff --git a/tests/fuzz/curl_fuzzer.cc b/tests/fuzz/curl_fuzzer.cc
index bbf91c222..fadb3231b 100644
--- a/tests/fuzz/curl_fuzzer.cc
+++ b/tests/fuzz/curl_fuzzer.cc
@@ -136,6 +136,12 @@ int fuzz_initialize_fuzz_data(FUZZ_DATA *fuzz,
fuzz_read_callback));
FTRY(curl_easy_setopt(fuzz->easy, CURLOPT_READDATA, fuzz));
+ /* Set the standard write function callback. */
+ FTRY(curl_easy_setopt(fuzz->easy,
+ CURLOPT_WRITEFUNCTION,
+ fuzz_write_callback));
+ FTRY(curl_easy_setopt(fuzz->easy, CURLOPT_WRITEDATA, fuzz));
+
/* Can enable verbose mode by changing 0L to 1L */
FTRY(curl_easy_setopt(fuzz->easy, CURLOPT_VERBOSE, 0L));
@@ -270,6 +276,30 @@ static size_t fuzz_read_callback(char *buffer,
}
/**
+ * Callback function for handling data output quietly.
+ */
+static size_t fuzz_write_callback(void *contents,
+ size_t size,
+ size_t nmemb,
+ void *ptr)
+{
+ size_t total = size * nmemb;
+ FUZZ_DATA *fuzz = (FUZZ_DATA *)ptr;
+ size_t copy_len = total;
+
+ /* Restrict copy_len to at most TEMP_WRITE_ARRAY_SIZE. */
+ if(copy_len > TEMP_WRITE_ARRAY_SIZE) {
+ copy_len = TEMP_WRITE_ARRAY_SIZE;
+ }
+
+ /* Copy bytes to the temp store just to ensure the parameters are
+ exercised. */
+ memcpy(fuzz->write_array, contents, copy_len);
+
+ return total;
+}
+
+/**
* TLV access function - gets the first TLV from a data stream.
*/
int fuzz_get_first_tlv(FUZZ_DATA *fuzz,
diff --git a/tests/fuzz/curl_fuzzer.h b/tests/fuzz/curl_fuzzer.h
index 2dd3827d0..e7af89bb4 100644
--- a/tests/fuzz/curl_fuzzer.h
+++ b/tests/fuzz/curl_fuzzer.h
@@ -46,6 +46,9 @@
#define TLV_RC_NO_MORE_TLVS 1
#define TLV_RC_SIZE_ERROR 2
+/* Temporary write array size */
+#define TEMP_WRITE_ARRAY_SIZE 10
+
/**
* Byte stream representation of the TLV header. Casting the byte stream
* to a TLV_RAW allows us to examine the type and length.
@@ -98,6 +101,9 @@ typedef struct fuzz_data
/* Parser state */
FUZZ_PARSE_STATE state;
+ /* Temporary writefunction state */
+ char write_array[TEMP_WRITE_ARRAY_SIZE];
+
/* Response data and length */
const uint8_t *rsp1_data;
size_t rsp1_data_len;
@@ -142,6 +148,10 @@ static size_t fuzz_read_callback(char *buffer,
size_t size,
size_t nitems,
void *ptr);
+static size_t fuzz_write_callback(void *contents,
+ size_t size,
+ size_t nmemb,
+ void *ptr);
int fuzz_get_first_tlv(FUZZ_DATA *fuzz, TLV *tlv);
int fuzz_get_next_tlv(FUZZ_DATA *fuzz, TLV *tlv);
int fuzz_get_tlv_comn(FUZZ_DATA *fuzz, TLV *tlv);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 211/256: RELEASE-NOTES: synced with 5fe85587c, (continued)
- [GNUnet-SVN] [gnurl] 211/256: RELEASE-NOTES: synced with 5fe85587c, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 99/256: asyn-thread: Fixed cleanup after OOM, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 109/256: polarssl: fix multissl breakage, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 84/256: vtls: allow selecting which SSL backend to use at runtime, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 125/256: test564: Add a warning comment about shell profile output., gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 179/256: mbedtls: enable CA path processing, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 216/256: examples/post-callback: use long for CURLOPT_POSTFIELDSIZE, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 184/256: checksrc: detect and warn for lack of spaces next to plus signs, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 202/256: schannel: Support partial send for when data is too large, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 162/256: configure: remove --enable-soname-bump and SONAME_BUMP, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 207/256: ossfuzz: don't write out to stdout,
gnunet <=
- [GNUnet-SVN] [gnurl] 108/256: configure: remove the leading comma from the backends list, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 107/256: examples/sslbackend.c: fix failure of 'make checksrc', gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 89/256: metalink: allow compiling with multiple SSL backends, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 81/256: vtls: encapsulate SSL backend-specific data, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 78/256: urldata.h: remove support for obsolete PolarSSL version, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 116/256: ossfuzz: additional seed corpora, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 111/256: darwinssl: handle long strings in TLS certs (follow-up), gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 144/256: docs: Update to secure URL versions, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 152/256: docs/curl_mime_*.3: use correct variable types in examples, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 74/256: vtls: remove obsolete declarations of SSL backend functionality, gnunet, 2017/10/06