Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__cxa_demangle terminates the program on failure to allocate #64505

Open
ldionne opened this issue Aug 7, 2023 · 0 comments
Open

__cxa_demangle terminates the program on failure to allocate #64505

ldionne opened this issue Aug 7, 2023 · 0 comments
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.

Comments

@ldionne
Copy link
Member

ldionne commented Aug 7, 2023

As explained in https://reviews.llvm.org/D155598, we currently terminate the program after failing to (re)allocate inside the Itanium demangler. This happens when we fail to grow the OutputBuffer inside ItaniumDemangle.h.

Instead, we should properly handle failure-to-allocate inside ItaniumDemangle.h and propagate something like an error code or a std::expected to the caller of all functions in the demangler that can allocate. Then, we could make sure that __cxa_demangle returns nullptr when it fails to demangle the input due to any error, as it is supposed to.

@ldionne ldionne added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.
Projects
None yet
Development

No branches or pull requests

1 participant