You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function install_bad_alloc_error_handler asserts that a bad_alloc error handler is not already installed.
However, it actually checks for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler is already installed.
Correct behavior would be to only crash if a bad_alloc handler is already installed, making it independent from fatal-error handlers.
Minimal working example:
#include<llvm/Support/ErrorHandling.h>intmain() {
llvm::install_fatal_error_handler([](void*,constchar*,bool){});
llvm::install_bad_alloc_error_handler([](void*,constchar*,bool){}); // <-- Crash occurs here
}
Previously, the function `install_bad_alloc_error_handler` was asserting that a bad_alloc error handler was not already installed. However, it was actually checking for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler was already installed.
Fixes#83040
cuviper
added a commit
to cuviper/rust
that referenced
this issue
Mar 15, 2024
The bad-alloc installer was incorrectly asserting that the other handler
isn't set yet, instead of checking its own, but we can avoid that by
changing the order we install them.
Ref: llvm/llvm-project#83040
The function
install_bad_alloc_error_handler
asserts that a bad_alloc error handler is not already installed.However, it actually checks for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler is already installed.
Correct behavior would be to only crash if a bad_alloc handler is already installed, making it independent from fatal-error handlers.
Minimal working example:
Propsed Fix:
The text was updated successfully, but these errors were encountered: