W32 VS: really muted run-time warnings about data truncation

This commit is contained in:
Evgeny Grin (Karlson2k)
2023-09-13 17:10:44 +03:00
parent a4b7990e5b
commit 49942a4a3f
8 changed files with 41 additions and 1 deletions
+9
View File
@@ -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
+8
View File
@@ -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.
*
+5
View File
@@ -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_
+2
View File
@@ -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
+7
View File
@@ -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 */
+5
View File
@@ -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_
+5
View File
@@ -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_
-1
View File
@@ -92,7 +92,6 @@
<ItemDefinitionGroup Condition="'$(UseDebugLibraries)'=='true'">
<ClCompile>
<Optimization>Disabled</Optimization>
<SmallerTypeCheck>true</SmallerTypeCheck>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>