[openssl] master update

Dr. Paul Dale pauli at openssl.org
Tue Jun 22 07:19:24 UTC 2021

The branch master has been updated
       via  f31bbeff048056874fcc4e6b33ffb847369f65c5 (commit)
      from  3b1978e4860770089b6244c549059c43bd9cc4da (commit)

- Log -----------------------------------------------------------------
commit f31bbeff048056874fcc4e6b33ffb847369f65c5
Author: Pauli <pauli at openssl.org>
Date:   Sun Jun 20 12:40:48 2021 +1000

    testutil: preserve app_malloc()'s failure behaviour
    app_malloc() terminates execution if the allocation fails.  The tests implement
    their own app_malloc() in an attempt to reduce the amount of code pulled in.
    This version also needs to terminate on failed allocation.  The alternative
    would be adding failed allocation checks pervasively throughout the apps's
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15836)


Summary of changes:
 test/testutil/apps_mem.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/test/testutil/apps_mem.c b/test/testutil/apps_mem.c
index 437bd89c59..ef5e266b25 100644
--- a/test/testutil/apps_mem.c
+++ b/test/testutil/apps_mem.c
@@ -7,13 +7,24 @@
  * https://www.openssl.org/source/license.html
+#include <stdlib.h>
 #include "apps.h"
+#include "../testutil.h"
 /* shim that avoids sucking in too much from apps/apps.c */
 void *app_malloc(size_t sz, const char *what)
-    void *vp = OPENSSL_malloc(sz);
+    void *vp;
+    /*
+     * This isn't ideal but it is what the app's app_malloc() does on failure.
+     * Instead of exiting with a failure, abort() is called which makes sure
+     * that there will be a good stack trace for debugging purposes.
+     */
+    if (!TEST_ptr(vp = OPENSSL_malloc(sz))) {
+        TEST_info("Could not allocate %zu bytes for %s\n", sz, what);
+        abort();
+    }
     return vp;

More information about the openssl-commits mailing list