You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/11/14 14:53:10 UTC

[qpid-proton] branch master updated: PROTON-2136 Fix fuzz-connection-driver to be tolerant of NULL input buffer

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/master by this push:
     new 776b1fe  PROTON-2136 Fix fuzz-connection-driver to be tolerant of NULL input buffer
776b1fe is described below

commit 776b1febebe26447346e534e36c91420b6b15395
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Wed Nov 13 13:29:29 2019 +0100

    PROTON-2136 Fix fuzz-connection-driver to be tolerant of NULL input buffer
---
 c/tests/fuzz/fuzz-connection-driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/c/tests/fuzz/fuzz-connection-driver.c b/c/tests/fuzz/fuzz-connection-driver.c
index 62b4172..ba06508 100644
--- a/c/tests/fuzz/fuzz-connection-driver.c
+++ b/c/tests/fuzz/fuzz-connection-driver.c
@@ -90,7 +90,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
     fcd_read(&driver, &data, &size);
     if (VERBOSE)
       printf("size is %d, data is %p\n", (int)size, (void *)data);
-    pn_event_t *event;
     while ((event = pn_connection_driver_next_event(&driver)) != NULL) {
       handle(&app, event);
     }
@@ -200,7 +199,11 @@ size_t fcd_read(pn_connection_driver_t *driver, uint8_t **data, size_t *size) {
   pn_rwbytes_t buf = pn_connection_driver_read_buffer(driver);
   size_t s = (*size < buf.size) ? *size : buf.size;
   if (buf.start == NULL) {
-    exit(1);
+    // The engine offered a null buffer for further input.
+    // This is legit, because it is just that the "socket" was closed
+    //  for further input, after reading the invalid header.
+    *size = 0;
+    return *size;
   }
   memcpy(buf.start, *data, s);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org