bug-gnulib
[Top][All Lists]
Advanced

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

Suppressing sanitizer in sha256.c


From: Tim Rühsen
Subject: Suppressing sanitizer in sha256.c
Date: Tue, 3 Apr 2018 22:47:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

When running with clang's sanitizing on, there is a UB runtime error
triggered in sha256.c.

This is expected behavior but still it rings the 'alarm bell'.


This patch suppresses it:


diff --git a/lib/sha256.c b/lib/sha256.c
index 85405b20f..cf161c65c 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -448,6 +448,9 @@ static const uint32_t sha256_round_constants[64] = {
    It is assumed that LEN % 64 == 0.
    Most of this code comes from GnuPG's cipher/sha1.c.  */
 
+#ifdef __clang__
+__attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
 void
 sha256_process_block (const void *buffer, size_t len, struct sha256_ctx
*ctx)
 {


Regards, Tim






reply via email to

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