Open martonka opened 1 month ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 60.08%. Comparing base (
2075ae8
) to head (f571878
).
I added a second commit extending the SymbolizeWithDemangling (just demangle a longer function). It crashes without my fix.
I had another look at the existing unit tests and now I'm not convinced that trimming the output is a good idea. This will possibly result in some sort of ambiguity or even will confuse users.
The easiest way of fixing the issue is to simply return false
whenever the buffer size is too small to be consistent with the behavior of the existing demangler. In the long term, however, we should switch to dynamic memory (re)allocation (e.g., by using std::string
as the return type) to avoid insufficient buffer size situations.
@martonka I pushed some changes to your branch. Make sure to pull these before extending the PR.
If the demangled name is longer than out_size, the null terminator is missing from the output. This will cause a crash in the DemangleInplace() function (symbolize.cc) when calling strlen on the buffer.
Reproduction Steps:
Use a function with a demangled name longer than 256 characters. Attempt to log a fatal error with a stack trace. This will cause a crash. Example input for DemangleInplace that makes it crash (on Ubuntu): "_ZN4kudu9FsManager9AddTenantERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St8optionalIS6_ESASA"