]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Disable clang-format around line-wrap sensitive lines in malloc_test.c
authorBob Beck <beck@openssl.org>
Fri, 28 Nov 2025 18:20:53 +0000 (11:20 -0700)
committerTomas Mraz <tomas@openssl.org>
Wed, 3 Dec 2025 13:40:56 +0000 (14:40 +0100)
If OPENSSL_LINE ends up on a different line than the following call here,
this test breaks.

We should perhaps reconsider if testing the reporting of OPENSSL_LINE
is what we want in a malloc test, but that's for another time than now.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29241)

test/mem_alloc_test.c

index 98283121a64941c1b5479d529cf6dfcefc053917..cf0a802ae1fae40ea3f5daf1a0e25963829ad0e6 100644 (file)
@@ -433,26 +433,42 @@ static int test_xalloc(const bool secure, const bool array, const bool zero,
         if (secure) {
             if (array) {
                 if (zero)
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_secure_calloc(td->nmemb, td->size);
+                    /* clang-format on */
                 else
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc_array(td->nmemb, td->size);
+                    /* clang-format on */
             } else {
                 if (zero)
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_secure_zalloc(sz);
+                    /* clang-format on */
                 else
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc(sz);
+                    /* clang-format on */
             }
         } else {
             if (array) {
                 if (zero)
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_calloc(td->nmemb, td->size);
+                    /* clang-format on */
                 else
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_malloc_array(td->nmemb, td->size);
+                    /* clang-format on */
             } else {
                 if (zero)
+                    /* clang-format off*/
                     ln = OPENSSL_LINE, ret = OPENSSL_zalloc(sz);
+                    /* clang-format on */
                 else
+                    /* clang-format off*/
                     ln = OPENSSL_LINE, ret = OPENSSL_malloc(sz);
+                    /* clang-format on */
             }
         }
     } else {
@@ -549,14 +565,22 @@ static int test_xrealloc(const bool clear, const bool array, const bool macro,
         if (macro) {
             if (array) {
                 if (clear)
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc_array(ret, old_nmemb, nmemb, td->size);
+                    /* clang-format on */
                 else
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_realloc_array(ret, nmemb, td->size);
+                    /* clang-format on*/
             } else {
                 if (clear)
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc(ret, old_sz, sz);
+                    /* clang-format on */
                 else
+                    /* clang-format off */
                     ln = OPENSSL_LINE, ret = OPENSSL_realloc(ret, sz);
+                    /* clang-format on */
             }
         } else {
             if (array) {
@@ -647,9 +671,14 @@ static int test_xaligned_alloc(const bool array, const bool macro,
 
     if (macro) {
         if (array) {
+            /* clang-format off */
             ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc_array(td->nmemb, td->size, td->align, &freeptr);
+            /* clang-format on */
+
         } else {
+            /* clang-format off */
             ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc(sz, td->align, &freeptr);
+            /* clang-format on */
         }
     } else {
         if (array)