From 74f8cd37089975bbc84bd9f9c7d908c18bccf398 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 30 Nov 2025 03:45:55 +0000 Subject: [PATCH] Stop panic propagation on malloc_stats_print() callback. Signed-off-by: Jason Volk --- src/core/alloc/je.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/alloc/je.rs b/src/core/alloc/je.rs index 5151f845..54e879e9 100644 --- a/src/core/alloc/je.rs +++ b/src/core/alloc/je.rs @@ -117,6 +117,12 @@ pub fn memory_stats(opts: &str) -> Option { } unsafe extern "C" fn malloc_stats_cb(opaque: *mut c_void, msg: *const c_char) { + catch_unwind(move || handle_malloc_stats(opaque, msg)) + .map_err(|_| abort()) + .ok(); +} + +fn handle_malloc_stats(opaque: *mut c_void, msg: *const c_char) { // SAFETY: we have to trust the opaque points to our String let res: &mut String = unsafe { opaque