Avoid abort() in test/integration/cpp/infallible_new_true.

Allow setting the safety check abort hook through mallctl, which avoids abort()
and core dumps.
This commit is contained in:
Qi Wang
2022-04-21 16:31:33 -07:00
committed by Qi Wang
parent 9a242f16d9
commit 391bad4b95
4 changed files with 82 additions and 49 deletions

View File

@@ -4,8 +4,11 @@
void safety_check_fail_sized_dealloc(bool current_dealloc, const void *ptr,
size_t true_size, size_t input_size);
void safety_check_fail(const char *format, ...);
typedef void (*safety_check_abort_hook_t)(const char *message);
/* Can set to NULL for a default. */
void safety_check_set_abort(void (*abort_fn)(const char *));
void safety_check_set_abort(safety_check_abort_hook_t abort_fn);
JEMALLOC_ALWAYS_INLINE void
safety_check_set_redzone(void *ptr, size_t usize, size_t bumped_usize) {