Skip to content

Commit

Permalink
ctest: fix asan on msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Oct 11, 2024
1 parent f5bd0d1 commit 4386bef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion misc/tests/ctest.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ static void sighandler(int signum)
int ctest_main(int argc, const char *argv[]);
#ifdef __GNUC__
__attribute__((no_sanitize_address))
#elif defined _MSC_VER
__declspec(no_sanitize_address)
#endif
int ctest_main(int argc, const char *argv[])
{
Expand Down Expand Up @@ -558,7 +560,12 @@ int ctest_main(int argc, const char *argv[])
#else
#define CTEST_IMPL_MAGIC_SEEK 0 /* access only 4 bytes outside outer ctest entry bounds */
#endif
for (m = magic_begin; magic_begin - m <= num_ints + CTEST_IMPL_MAGIC_SEEK; --m) {
#if (defined _MSC_VER && defined __SANITIZE_ADDRESS__)
#define CTEST_IMPL_MAGIC_OFFSET 4
#else
#define CTEST_IMPL_MAGIC_OFFSET 0
#endif
for (m = magic_begin - CTEST_IMPL_MAGIC_OFFSET; magic_begin - m <= num_ints + CTEST_IMPL_MAGIC_SEEK; --m) {
if (*m == 0xBADCAFE1) {
magic_begin = m;
m -= num_ints - 1;
Expand Down

0 comments on commit 4386bef

Please sign in to comment.