diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2021-08-25 14:30:12 +0200 |
---|---|---|
committer | Nicola Tuveri <nic.tuv@gmail.com> | 2021-08-27 14:54:08 +0300 |
commit | e93a82da60f52e6fc799323b99499ee51e8c7215 (patch) | |
tree | 231431163ea0fce7c9dbd15478a2f2423a3a78eb /test | |
parent | 58e1e397c6774be11b903c0f88e85bd2b8c4206f (diff) |
Fix instances of pointer addition with the NULL pointer
ubsan found undefined pointer addtions in
crypto/bio/bss_mem.c (mem_ctrl),
crypto/pem/pem_lib.c (PEM_read_bio_ex),
test/testutil/format_output.c (test_fail_string_common,
test_fail_memory_common).
Mostly a straight back-port-of: a07dc81
Additionally enable the ubsan run-checker, to prevent regressions.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16423)
Diffstat (limited to 'test')
-rw-r--r-- | test/testutil/format_output.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/testutil/format_output.c b/test/testutil/format_output.c index 6ee2a1d266..f42141fd8d 100644 --- a/test/testutil/format_output.c +++ b/test/testutil/format_output.c @@ -107,8 +107,10 @@ static void test_fail_string_common(const char *prefix, const char *file, if (diff && i > 0) test_printf_stderr("% 4s %s\n", "", bdiff); } - m1 += n1; - m2 += n2; + if (m1 != NULL) + m1 += n1; + if (m2 != NULL) + m2 += n2; l1 -= n1; l2 -= n2; cnt += width; @@ -495,8 +497,10 @@ static void test_fail_memory_common(const char *prefix, const char *file, if (diff && i > 0) test_printf_stderr("% 4s %s\n", "", bdiff); } - m1 += n1; - m2 += n2; + if (m1 != NULL) + m1 += n1; + if (m2 != NULL) + m2 += n2; l1 -= n1; l2 -= n2; cnt += bytes; |