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
Add helper demangle function for 3rd party tools #16295
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#16295" |
The linked to script clones a repository containing a thin C-api wrapper around |
return 0; | ||
|
||
memcpy(buffer, demangled.ptr, demangled.length); | ||
buffer[demangled.length] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an out-of-bounds write if bufferLength == demangled.length
Example of tools that'd benefit it:
https://github.com/KDAB/hotspot
Their build script is unnecessarily complex: https://github.com/KDAB/hotspot/blob/6f9f958c4ff68b3c94ccca0fa3c2d86c46c9185f/scripts/appimage/Dockerfile#L88-L98
Instead, i propose to add this function into druntime, so the tool can directly consume it
Making the whole process much easier:
https://github.com/KDAB/perfparser/blob/f38363858a56e1dc3b33b998e5a0f6c7046b8993/app/demangler.cpp#L40