gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (bade8d9c -> c7fce141)


From: gnunet
Subject: [libmicrohttpd] branch master updated (bade8d9c -> c7fce141)
Date: Wed, 19 Aug 2020 09:58:23 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository libmicrohttpd.

    from bade8d9c bump version
     new 773d6cce add logic to check return value of MHD_pool_reallocate()
     new c7fce141 indentation fix

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                   |  4 ++++
 src/microhttpd/connection.c | 21 +++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a2e24c02..ee418a04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed 19 Aug 2020 09:40:39 AM CEST
+    Add logic to check on MHD_pool_reallocate() failure reported on the
+    mailinglist (will NOT yet fix the issue). -CG
+
 Sun 26 Jul 2020 01:56:54 PM CEST
     Add MHD_create_response_from_pipe() to allow creating a response based
     on data read from a pipe. -CG
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index ceae1cf8..02497cc6 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1147,6 +1147,7 @@ try_grow_read_buffer (struct MHD_Connection *connection,
 {
   size_t new_size;
   size_t avail_size;
+  void *rb;
 
   avail_size = MHD_pool_get_free (connection->pool);
   if (0 == avail_size)
@@ -1175,10 +1176,22 @@ try_grow_read_buffer (struct MHD_Connection *connection,
     new_size = connection->read_buffer_size + grow_size;
   }
   /* we can actually grow the buffer, do it! */
-  connection->read_buffer = MHD_pool_reallocate (connection->pool,
-                                                 connection->read_buffer,
-                                                 connection->read_buffer_size,
-                                                 new_size);
+  rb = MHD_pool_reallocate (connection->pool,
+                            connection->read_buffer,
+                            connection->read_buffer_size,
+                            new_size);
+  if (NULL == rb)
+  {
+    /* This should NOT be possible: we just computed 'new_size' so that
+       it should fit. If it happens, somehow our read buffer is not in
+       the right position in the pool, say because someone called
+       MHD_pool_allocate() without 'from_end' set to 'true'? Anyway,
+       should be investigated! (Ideally provide all data from
+       *pool and connection->read_buffer and new_size for debugging). *///
+    mhd_assert (0);
+    return false;
+  }
+  connection->read_buffer = rb;
   mhd_assert (NULL != connection->read_buffer);
   connection->read_buffer_size = new_size;
   return true;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]