gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/03: W32 VS: really muted run-time warnings about data


From: gnunet
Subject: [libmicrohttpd] 01/03: W32 VS: really muted run-time warnings about data truncation
Date: Wed, 13 Sep 2023 16:12:04 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 49942a4a3feffeeb592323959cfd0b42718548f1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Sep 13 17:10:44 2023 +0300

    W32 VS: really muted run-time warnings about data truncation
---
 src/include/mhd_options.h              | 9 +++++++++
 src/microhttpd/digestauth.c            | 8 ++++++++
 src/microhttpd/md5.c                   | 5 +++++
 src/microhttpd/mhd_bithelpers.h        | 2 ++
 src/microhttpd/mhd_str.c               | 7 +++++++
 src/microhttpd/sha256.c                | 5 +++++
 src/microhttpd/sha512_256.c            | 5 +++++
 w32/common/common-build-settings.props | 1 -
 8 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h
index faefd328..f5334e1d 100644
--- a/src/include/mhd_options.h
+++ b/src/include/mhd_options.h
@@ -172,6 +172,15 @@
 #endif /* ! (MHD_ASAN_ACTIVE && HAVE_SANITIZER_ASAN_INTERFACE_H &&
            (FUNC_ATTR_PTRCOMPARE_WORKS || FUNC_ATTR_NOSANITIZE_WORKS))   */
 
+#ifndef _MSC_FULL_VER
+#  define MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_ /* empty */
+#  define MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_ /* empty */
+#else  /* _MSC_FULL_VER */
+#  define MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_ \
+   __pragma(runtime_checks("c", off))
+#  define MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_ \
+   __pragma(runtime_checks("c", restore))
+#endif /* _MSC_FULL_VER */
 
 /**
  * Automatic string with the name of the current function
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 85a46260..4eeff3ca 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -764,6 +764,8 @@ get_nonce_timestamp (const char *const nonce,
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
 /**
  * Super-fast xor-based "hash" function
  *
@@ -791,6 +793,8 @@ fast_simple_hash (const uint8_t *data,
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
+
 /**
  * Get index of the nonce in the nonce-nc map array.
  *
@@ -1756,6 +1760,8 @@ calculate_add_nonce (struct MHD_Connection *const 
connection,
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
 /**
  * Calculate the server nonce so that it mitigates replay attacks and add
  * the new nonce to the nonce-nc map array.
@@ -1859,6 +1865,8 @@ calculate_add_nonce_with_retry (struct MHD_Connection 
*const connection,
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
+
 /**
  * Calculate userdigest, return it as binary data.
  *
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 609ed50f..911fc364 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -54,6 +54,8 @@ MHD_MD5_init (struct Md5Ctx *ctx)
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
 /**
  * Base of MD5 transformation.
  * Gets full 64 bytes block of data and updates hash values;
@@ -544,3 +546,6 @@ MHD_MD5_finish (struct Md5Ctx *ctx,
   /* Erase potentially sensitive data. */
   memset (ctx, 0, sizeof(struct Md5Ctx));
 }
+
+
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index 94f4e1ab..8c2e7eca 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -45,6 +45,7 @@
 #  define _MHD_has_builtin_dummy 1
 #endif
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
 
 #ifdef MHD_HAVE___BUILTIN_BSWAP32
 #define _MHD_BYTES_SWAP32(value32)  \
@@ -388,6 +389,7 @@ _MHD_ROTR64 (uint64_t value64, int bits)
 
 #endif /* ! __builtin_rotateright64 */
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
 
 #ifdef _MHD_has_builtin_dummy
 /* Remove macro function replacement to avoid misdetection in files which
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index 402cd0bc..8943b46e 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -2259,6 +2259,10 @@ base64_char_to_value_ (uint8_t c)
 
 #endif /* MHD_BASE64_FUNC_VERSION == 1 */
 
+
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
+
 size_t
 MHD_base64_to_bin_n (const char *base64,
                      size_t base64_len,
@@ -2428,6 +2432,9 @@ MHD_base64_to_bin_n (const char *base64,
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
+
+
 #undef MHD_base64_map_type_
 
 #endif /* BAUTH_SUPPORT */
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c
index 2f9edf6a..917bb22b 100644
--- a/src/microhttpd/sha256.c
+++ b/src/microhttpd/sha256.c
@@ -58,6 +58,8 @@ MHD_SHA256_init (struct Sha256Ctx *ctx)
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
 /**
  * Base of SHA-256 transformation.
  * Gets full 64 bytes block of data and updates hash values;
@@ -558,3 +560,6 @@ MHD_SHA256_finish (struct Sha256Ctx *ctx,
   /* Erase potentially sensitive data. */
   memset (ctx, 0, sizeof(struct Sha256Ctx));
 }
+
+
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
diff --git a/src/microhttpd/sha512_256.c b/src/microhttpd/sha512_256.c
index b7682b28..1e00e5d9 100644
--- a/src/microhttpd/sha512_256.c
+++ b/src/microhttpd/sha512_256.c
@@ -58,6 +58,8 @@ MHD_SHA512_256_init (struct Sha512_256Ctx *ctx)
 }
 
 
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_
+
 /**
  * Base of SHA-512/256 transformation.
  * Gets full 128 bytes block of data and updates hash values;
@@ -627,3 +629,6 @@ MHD_SHA512_256_finish (struct Sha512_256Ctx *ctx,
   /* Erase potentially sensitive data. */
   memset (ctx, 0, sizeof(struct Sha512_256Ctx));
 }
+
+
+MHD_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE_
diff --git a/w32/common/common-build-settings.props 
b/w32/common/common-build-settings.props
index a318184f..9d79bfeb 100644
--- a/w32/common/common-build-settings.props
+++ b/w32/common/common-build-settings.props
@@ -92,7 +92,6 @@
   <ItemDefinitionGroup Condition="'$(UseDebugLibraries)'=='true'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <SmallerTypeCheck>true</SmallerTypeCheck>
       
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ResourceCompile>

-- 
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]