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

ItaniumDemangler presumes allocator success #58289

Open
urnathan opened this issue Oct 11, 2022 · 1 comment
Open

ItaniumDemangler presumes allocator success #58289

urnathan opened this issue Oct 11, 2022 · 1 comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.

Comments

@urnathan
Copy link
Contributor

urnathan commented Oct 11, 2022

libcxxabi/src/demangle/ItaniumDemangle.h contains several instances of placement new:

   void *mem = ASTAllocator.allocateNodeArray(sz);
    Node **data = new (mem) Node *[sz];

These presume the allocator never returns nullptr. I.e. always succeeds or throws. That's in conflict with the itanum ABI library requirements, which have the demangler return an error code on memory exhastion. We don't do that, instead calling std::terminate on failure. But it would be good to be able to move to a more compliant demangler.

You'll notice the demangler's node allocator has smarts to check for nullptr.

We can't use exceptions here either, as (IIUC), the demangler should not require the unwinder. And besides we don't have an outer catch to turn that exception into an error code.

@EugeneZelenko EugeneZelenko added libc++abi libc++abi C++ Runtime Library. Not libc++. and removed new issue labels Oct 11, 2022
@dwblaikie
Copy link
Collaborator

sounds reasonable to me, FWIW

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

3 participants